device.connect(autoConnect: false).timeout(Duration(seconds: 5),
onTimeout: () {
print("flutter ble time out");
})
I want to stop this function befor the time out,how to do?
Timeout will happen after 5 seconds, so before that, if we want to disconnect the connection, use the below code, call it from any button press, see it should work.
device.disconnect();
Also, if you want to stop search use
FlutterBlue.instance.stopScan()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.