Commit abcc030

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2024-06-22 17:37:02
fix still scanning after connect
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent 23487c0
Changed files (1)
app
app/lib/bluetooth/device_scan_cubit.dart
@@ -77,9 +77,10 @@ class DeviceScanCubit extends Cubit<DeviceScanState> {
     // characteristic as users have to select their device anyways.
     if(state is DeviceSelected) return;
     final preferred = devices.firstWhereOrNull((dev) =>
-        settings.knownBleDev.contains(dev.device.platformName));
+      settings.knownBleDev.contains(dev.device.platformName));
     if (preferred != null) {
-      emit(DeviceSelected(preferred.device));
+      _flutterBluePlus.stopScan()
+        .then((_) => emit(DeviceSelected(preferred.device)));
     } else if (devices.isEmpty) {
       emit(DeviceListLoading());
     } else if (devices.length == 1) {