Skip to content

Commit 6ff02b4

Browse files
fix: duplicate logic removed
1 parent d7b309f commit 6ff02b4

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/bademagic_module/bluetooth/scan_state.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,17 @@ class ScanState extends NormalBleState {
2727
.contains(Guid("0000fee0-0000-1000-8000-00805f9b34fb")),
2828
orElse: () => throw Exception("Matching device not found."),
2929
);
30-
toast.showToast('Device found. Connecting...');
31-
isCompleted = true;
32-
await FlutterBluePlus.stopScan();
33-
nextStateCompleter.complete(ConnectState(
34-
scanResult: foundDevice,
35-
manager: manager,
36-
));
3730

3831
toast.showToast('Device found. Connecting...');
3932
isCompleted = true;
40-
FlutterBluePlus.stopScan();
33+
await FlutterBluePlus.stopScan();
4134

4235
nextStateCompleter.complete(ConnectState(
4336
scanResult: foundDevice,
4437
manager: manager,
4538
));
4639
} catch (e) {
47-
//ignore and keep scanning
40+
// Ignore and keep scanning
4841
}
4942
}
5043
},

0 commit comments

Comments
 (0)