scan method
Scan for Bluetooth LE devices until timeout
is reached.
Throw BTException if failed.
Implementation
@override
Future<List<BluetoothDevice>> scan({required Duration timeout}) async {
try {
Future.delayed(timeout).whenComplete(() => _stopScanPill.add(null));
await discovery().drain();
return _scanResults.value;
} on BTException catch (_) {
rethrow;
} on PlatformException catch (e) {
throw BTException.fromPlatform(e);
}
}