getMobileDataState method

Future<MobileDataState> getMobileDataState()

Retrieves the current mobile data state.

Implementation

Future<MobileDataState> getMobileDataState() async {
  try {
    final result = await _methodChannel
        .invokeMapMethod<String, dynamic>('getMobileData');
    if (result == null) {
      throw Exception("Failed to retrieve mobile data state.");
    }
    return MobileDataState.fromMap(result);
  } catch (e) {
    throw Exception("Error fetching mobile data state: $e");
  }
}