You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isConnecting =
false; ////Reset the connecting flag so that when the scan results come up they can be connected to if needed
isScanning = true;
notifyListeners();
BluetoothDevice scannedDevice;
scanSubscription = FlutterBluePlus.scanResults.listen(
(event) async {
log("Scan Result is $event ");
if (event.isNotEmpty) {
scannedDevice = event.elementAt(0).device;
FlutterBluePlus.stopScan();
scanSubscription!.cancel();
await connectToDevice(scannedDevice, onConnect);
}
},
onDone: () {
log("Scanning Done");
isScanning = false;
scanSubscription!.cancel();
notifyListeners();
},
);
await FlutterBluePlus.startScan(
timeout: const Duration(seconds: 10),
withServices: [Guid("0000acf0-0000-1000-8000-00805f9b34fb")],
);
} catch (e) {
log("Error in startDiscovery $e");
}
Requirements
Have you checked this problem on the example app?
Yes
FlutterBluePlus Version
1.20.7
Flutter Version
3.13.5
What OS?
Android
OS Version
12
Bluetooth Module
Esp32
What is your problem?
The on done method in the scanResults stream is not called ;
`Future startDiscovery(Function onConnect) async {
try {
// ignore: unused_local_variable
StreamSubscription<List>? scanSubscription;
await askForPermission();
_scannedDevices.clear();
}`
Logs
The text was updated successfully, but these errors were encountered: