Skip to content

Commit

Permalink
set streamSubscriptions to null on
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed May 16, 2024
1 parent 314bede commit f554aa8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Backend/Bluetooth/bluetooth_manager_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,23 @@ Future<void> initFlutterBluePlus(InitFlutterBluePlusRef ref) async {
}
//cancel streams
await _keepAliveStreamSubscription?.cancel();
_keepAliveStreamSubscription = null;
await _onCharacteristicReceivedStreamSubscription?.cancel();
_onCharacteristicReceivedStreamSubscription = null;
await _onConnectionStateChangedStreamSubscription?.cancel();
_onConnectionStateChangedStreamSubscription = null;
await _onDiscoveredServicesStreamSubscription?.cancel();
_onDiscoveredServicesStreamSubscription = null;
await _onMtuChanged?.cancel();
_onMtuChanged = null;
await _adapterStateStreamSubscription?.cancel();
_adapterStateStreamSubscription = null;
await _onScanResultsStreamSubscription?.cancel();
_onScanResultsStreamSubscription = null;
await _onServicesResetStreamSubscription?.cancel();
_onServicesResetStreamSubscription = null;
await _onReadRssiStreamSubscription?.cancel();
_onReadRssiStreamSubscription = null;
// Mark all gear disconnected;
ref.read(knownDevicesProvider).forEach(
(key, value) => value.deviceConnectionState.value = ConnectivityState.disconnected,
Expand Down

0 comments on commit f554aa8

Please sign in to comment.