getDeviceSimNetworks method

Future<List<Network>> getDeviceSimNetworks()

Retrieves a list of Network of SIMs in the device Requires the READ_PHONE_STATE permission to have already been granted

Implementation

Future<List<Network>> getDeviceSimNetworks() async {
  final networksListData = await _methodChannel.invokeMethod(
    _getDeviceSimNetworksMethodName,
  ) as List<dynamic>?;

  if (networksListData != null) {
    return networksListData.map((map) {
      return Network(
        map["name"],
        map["mcc"],
        map["mnc"],
        map["countryName"],
        map["countryIsoCode"],
        map["countryDialCode"],
      );
    }).toList(growable: false);
  } else {
    return [];
  }
}