disconnect method

  1. @override
Future disconnect({
  1. Duration? timeout,
})
override

Implementation

@override
Future disconnect({Duration? timeout}) async {
  if (Platform.isWindows) {
    _closeWindowsPrinter();
  } else if (Platform.isAndroid) {
    if (_androidConnected) {
      _androidConnected = false;
      try {
        await usbPrinter.close();
      } catch (_) {
        // Already closed / detached: nothing to clean up.
      }
    }
  }
  if (timeout != null) {
    await Future.delayed(timeout);
  }
  return true;
}