disconnect method

Future<NetworkPrintResult> disconnect({
  1. Duration? timeout,
})

Implementation

Future<NetworkPrintResult> disconnect({Duration? timeout}) async {
  await _socket.flush();
  await _socket.close();
  _isConnected = false;
  if (timeout != null) {
    await Future.delayed(timeout, () => null);
  }
  return Future<NetworkPrintResult>.value(NetworkPrintResult.success);
}