BbsonLin/serial_port_flutter

flutter app closed when serialPort.close() called

Closed this issue · 4 comments

flutter app closed when serialPort.close() called

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

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. ♪(・ω・)ノ

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 ♪(・ω・)ノ

@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.