BbsonLin / serial_port_flutter

A Flutter plugin integrated with Android-SerialPort-API
Other
29 stars 24 forks source link

flutter app closed when serialPort.close() called #3

Closed WebSheldon closed 4 years ago

BbsonLin commented 4 years ago

Hi @WebSheldon Please provide more information, like your develop environment and debug logs.

WebSheldon commented 4 years ago

Develop environment: flutter version: 1.12.13+hotfix.8 • channel stable plugins: serial_port_flutter: ^0.1.0 stream_transform: ^0.0.19

Flutter Codes:

            FlatButton(
              onPressed: openAndListen,
              child: Text("Open"),
            ),
            FlatButton(
              onPressed: close,
              child: Text("Close"),
            ),

void openAndListen() async { _serialPort = await FlutterSerialPort.createSerialPort(theDevice, baudrate); bool openResult = await _serialPort.open(); }

void close() async { if(_serialPort.isConnected){ await _serialPort.close(); } }

Can you try this codes with the same environment, Thanks for your help. ♪(・ω・)ノ

WebSheldon commented 4 years ago

Finally, I downgrade my flutter version to 1.9.1+hotfix.2 • channel stable. The problem was solved without any code modified. It's so strange! Thanks ♪(・ω・)ノ

BbsonLin commented 4 years ago

@WebSheldon I develop this package on 1.9.1+hotfix.5. I didn't try the latest Flutter version, and I'll look upon it. 😀 Thanks to let me know about this issue.