fix: lifecycle
This commit is contained in:
@ -66,15 +66,21 @@ class _BootloaderRecoveryUpdatePageState
|
||||
unawaited(_firmwareProgressSubscription?.cancel());
|
||||
unawaited(() async {
|
||||
await service?.dispose();
|
||||
await _disconnectBootloaderIfStillConnected(bluetooth: bluetooth);
|
||||
await _disconnectBootloaderIfStillConnected(
|
||||
bluetooth: bluetooth,
|
||||
allowRefRead: false,
|
||||
);
|
||||
}());
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _disconnectBootloaderIfStillConnected({
|
||||
BluetoothController? bluetooth,
|
||||
bool allowRefRead = true,
|
||||
}) async {
|
||||
bluetooth ??= ref.read(bluetoothProvider).valueOrNull;
|
||||
if (bluetooth == null && allowRefRead) {
|
||||
bluetooth = ref.read(bluetoothProvider).valueOrNull;
|
||||
}
|
||||
if (bluetooth == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user