setWifiState method

Future<void> setWifiState(
  1. bool enable
)

Enables or disables the Wi-Fi.

Implementation

Future<void> setWifiState(bool enable) async {
  try {
    await _methodChannel.invokeMethod('setWifi', {'wifi': enable});
  } catch (e) {
    throw Exception("Error setting Wi-Fi state: $e");
  }
}