From 60def2065b950d54a8a638acecc3d944fde6d469 Mon Sep 17 00:00:00 2001 From: Codel1417 Date: Fri, 20 Dec 2024 20:04:09 -0500 Subject: [PATCH] check if bluetooth is on before scanning --- lib/Backend/Bluetooth/bluetooth_manager_plus.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Backend/Bluetooth/bluetooth_manager_plus.dart b/lib/Backend/Bluetooth/bluetooth_manager_plus.dart index 65f186b2..a269fdb1 100644 --- a/lib/Backend/Bluetooth/bluetooth_manager_plus.dart +++ b/lib/Backend/Bluetooth/bluetooth_manager_plus.dart @@ -499,7 +499,7 @@ enum ScanReason { background, addGear, manual, notScanning } ScanReason _scanReason = ScanReason.notScanning; Future beginScan({required ScanReason scanReason, Duration? timeout}) async { - if (_didInitFlutterBluePlus && !flutterBluePlus.isScanningNow) { + if (_didInitFlutterBluePlus && !flutterBluePlus.isScanningNow && isBluetoothEnabled.value) { _bluetoothPlusLogger.info("Starting scan"); _scanReason = scanReason; await flutterBluePlus.startScan(withServices: DeviceRegistry.getAllIds().map(Guid.new).toList(), continuousUpdates: timeout == null, androidScanMode: AndroidScanMode.lowPower, timeout: timeout);