mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-14 22:55:12 +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() {
|
||||
_connector.removeListener(_connectionListener);
|
||||
unawaited(_bluetoothStateSubscription.cancel());
|
||||
if (!_changedNavigation) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
unawaited(_connector.disconnect(manual: true));
|
||||
});
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user