getNetworkInfo method

  1. @override
Future<List<NetworkInfo>> getNetworkInfo()
override

Implementation

@override
Future<List<NetworkInfo>> getNetworkInfo() async {
  try {
    final List<dynamic>? res = await methodChannel.invokeListMethod('getNetworkInfo');
    return SafeParser.parseList<NetworkInfo>(res, (m) => NetworkInfo.fromMap(m));
  } on PlatformException catch (e) {
    throw DeviceInspectorException(_mapErrorCode(e.code), e.message ?? 'Failed to get network info', cause: e);
  } catch (e) {
    return const [];
  }
}