Closed smofe closed 3 months ago
I've noticed that this only happens when I dispose the SerialPortConfig before. What I do when I connect to the device:
port.openReadWrite();
SerialPortConfig config = SerialPortConfig();
config.baudRate = baudRate;
config.bits = 8;
config.stopBits = 1;
config.parity = SerialPortParity.none;
config.setFlowControl(SerialPortFlowControl.xonXoff);
port.config = config;
print("Baud rate: ${port.config.baudRate}, "
"Bits: ${port.config.bits}, "
"Stop bits: ${port.config.stopBits}, "
"Parity: ${port.config.parity}, "
"XonXoff: ${port.config.xonXoff}");
config.dispose();
Removing the config.dispose()
fixes the problem with the app crashing when calling the disconnect method described above. Can someone explain to me why this is happening and if this is expected behaviour?
Did you want port.dispose()
instead of config.dispose()
?
Closed as disposing a closed serial throws exception is an expected behavior from libserialport
When I try to call the
dispose()
method of aSerialPort
object, the app crashes. MacOS generates the following error report:This happens when I execute the following method:
Flutter doctor:
Click to show
``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale de) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] Connected device (2 available) ```Do you have any idea why this is happening? Any help is very much appreciated!