更新
This commit is contained in:
@@ -67,17 +67,12 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
blueteethBindController.updateAll();
|
||||
}
|
||||
|
||||
@override
|
||||
@override
|
||||
void dispose() {
|
||||
_isDisposed = true;
|
||||
_cleanupResources();
|
||||
try {
|
||||
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
|
||||
bledevice.disconnect();
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功");
|
||||
} catch (e) {
|
||||
DailyLogUtils.writeError("关闭蓝牙连接失败");
|
||||
}
|
||||
_disconnectDevice();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -1105,4 +1100,14 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
|
||||
onFailure: (res) {},
|
||||
);
|
||||
}
|
||||
|
||||
void _disconnectDevice() async {
|
||||
try {
|
||||
THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device);
|
||||
await bledevice.disconnect();
|
||||
DailyLogUtils.writeLog("关闭蓝牙连接成功");
|
||||
} catch (e) {
|
||||
DailyLogUtils.writeError("关闭蓝牙连接失败: $e");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user