wifiDisconnect method
void
wifiDisconnect(
{ - dynamic callback(
- bool isSuccess
)?,
})
Implementation
void wifiDisconnect({Function(bool isSuccess)? callback}) {
BasicMessageChannel messageChannel = const BasicMessageChannel(
messageForWifiChannelID, StandardMessageCodec());
Map map = {'wifiName': '', 'wifiPassword': '', 'operation': 'disconnect'};
messageChannel.send(map);
messageChannel.setMessageHandler((message) async {
if (message["isSuccess"] == true) {
Fluttertoast.showToast(msg: '切换wifi成功');
if (callback != null) {
callback(true);
}
} else {
Fluttertoast.showToast(msg: message["msg"]);
if (callback != null) {
callback(false);
}
}
});
}