getWifi method

Future<WifiState> getWifi()

Retrieves the current Wi-Fi state.

Implementation

Future<WifiState> getWifi() async {
  try {
    final result = await _methodChannel.invokeMapMethod<String, dynamic>(
      'getWifi',
    );
    if (result == null) {
      throw Exception("Failed to retrieve Wi-Fi state.");
    }
    return WifiState.fromMap(result);
  } catch (e) {
    throw Exception("Error fetching Wi-Fi state: $e");
  }
}