mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-16 13:50:48 +10:00
make stuff unawaited + maybe fix edge case?
This commit is contained in:
@@ -50,9 +50,8 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
|||||||
_bluetoothState = state;
|
_bluetoothState = state;
|
||||||
});
|
});
|
||||||
// Cancel scan if Bluetooth turns off while scanning
|
// Cancel scan if Bluetooth turns off while scanning
|
||||||
if (state != BluetoothAdapterState.on &&
|
if (state != BluetoothAdapterState.on) {
|
||||||
connector.state == MeshCoreConnectionState.scanning) {
|
unawaited(connector.stopScan());
|
||||||
connector.stopScan();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -62,7 +61,7 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
final connector = Provider.of<MeshCoreConnector>(context, listen: false);
|
final connector = Provider.of<MeshCoreConnector>(context, listen: false);
|
||||||
connector.removeListener(_connectionListener);
|
connector.removeListener(_connectionListener);
|
||||||
_bluetoothStateSubscription.cancel();
|
unawaited(_bluetoothStateSubscription.cancel());
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user