close method

Future<void> close()

Closes the currently open port and emits SerialEventType.disconnected.

Safe to call even if no port is open.

Implementation

Future<void> close() async {
  final path = _webPath;
  _stopSession();
  if (path != null) await closeWebPort(path);
  _eventController.add(SerialEvent(SerialEventType.disconnected, null));
}