disconnect method

Future<void> disconnect({
  1. int? delayMs,
})

Closes the printer Socket and disposes any received byte in buffer. delayMs: milliseconds to wait after destroying the socket

Implementation

Future<void> disconnect({int? delayMs}) async {
  if (delayMs != null && delayMs > 0) {
    await Future.delayed(Duration(milliseconds: delayMs));
  }

  _connected = false;
  _socket.destroy();
  _disposeInputBytes();
}