getCurrentNetworkType static method

Future<NetworkType> getCurrentNetworkType()

Get the current network type (mobile, wifi, or unknown)

Implementation

static Future<NetworkType> getCurrentNetworkType() async {
  final String networkType =
      await _channel.invokeMethod('getCurrentNetworkType');
  switch (networkType) {
    case 'mobile':
      return NetworkType.mobile;
    case 'wifi':
      return NetworkType.wifi;
    default:
      return NetworkType.unknown;
  }
}