mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-24 09:39:03 +10:00
Add post-frame callback to ensure disconnection on dispose when navigation hasn't changed
This commit is contained in:
committed by
just-stuff-tm
parent
dcad5c586d
commit
ca5784f3f8
@@ -68,6 +68,11 @@ class _ScannerScreenState extends State<ScannerScreen> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
_connector.removeListener(_connectionListener);
|
_connector.removeListener(_connectionListener);
|
||||||
unawaited(_bluetoothStateSubscription.cancel());
|
unawaited(_bluetoothStateSubscription.cancel());
|
||||||
|
if (!_changedNavigation) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
unawaited(_connector.disconnect(manual: true));
|
||||||
|
});
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user