Commit 3d403a7

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2024-05-21 11:07:29
add 2 minute timeout
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent 4c6f55f
Changed files (1)
app
lib
app/lib/bluetooth/ble_read_cubit.dart
@@ -34,6 +34,12 @@ class BleReadCubit extends Cubit<BleReadState> {
   BleReadCubit(this._device)
     : super(BleReadInProgress()){
     _subscription = _device.connectionState.listen(_onConnectionStateChanged);
+    // timeout
+    Timer(const Duration(minutes: 2), () {
+      if (super.state is BleReadInProgress) {
+        emit(BleReadFailure());
+      }
+    });
     unawaited(_ensureConnection());
   }