jpnurmi / flutter_libserialport

Serial Port for Flutter
https://pub.dev/packages/flutter_libserialport
MIT License
139 stars 80 forks source link

Uncaught Exception - SerialPortError: The operation completed successfully., errno = 0 #78

Closed chasersmith closed 11 months ago

chasersmith commented 11 months ago

I am unsure if this is a bug or a misunderstanding from me but, when I close a port via port.close(), a SerialPortError exception is thrown with the message, "The operation completed successfully. erno = 0".

image

The stack trace provides little information with no trace to my code.

image

I have tried wrapping the close() call in a try/catch statement which isn't catching the exception.

chasersmith commented 11 months ago

Found where to catch the exception. The exception is being called in my port reader stream listener, handled by invoking onError callback.

_reader = SerialPortReader(_port, timeout: 10);
_reader.stream.listen((event) {
  print('Incoming bytes: ${event.toList()}');
}, onError: (error) => print(error));