close method

Future<void> close()

Closes the hid device

Implementation

Future<void> close() async {
  var responsePort = ReceivePort();
  commandPort.send(USBIsolateCommand(
      responsePort.sendPort, USBDeviceCommand.close, null, null));
  var resp = await responsePort.first as USBIsolateResponse;
  if (resp.status != USBDeviceStatus.ok) {
    throw Exception("Error closing device: ${resp.errorMsg}");
  }
}