provisionWifiNetwork method
Implementation
@override
Future<bool> provisionWifiNetwork({
required EspWifiNetwork network,
String? password,
}) async {
try {
final wifiPassword = password ?? '';
if (network.security != EspWifiSecurity.WIFI_OPEN && wifiPassword.isEmpty) {
throw ErrorDescription('Password is required to connect wifi network.');
}
final result = await methodChannel.invokeMethod<bool>('provisionWifiNetwork', {
'ssid': network.ssid,
'password': wifiPassword,
}) ??
false;
return result;
} on PlatformException catch (e) {
throw _onPlatformException(e);
} catch (e) {
rethrow;
}
}