commonGetMobileNetworks method

Future<MobileNetworkList?> commonGetMobileNetworks({
  1. String? countryCode,
  2. String? mcc,
  3. Future<void>? abortTrigger,
})

List mobile networks

Lists mobile network codes (MCC/MNC) with their operator, country and calling code. Returns { items } ordered by mcc then mnc, without paging. Optional filters: countryCode (ISO 3166-1 alpha-2, either case) and mcc (3 digits); both together return the networks matching both. A malformed filter or an unknown query parameter returns 400 with code 10001.

Parameters:

  • String countryCode: Only networks of this country: an ISO 3166-1 alpha-2 code, in either case.

  • String mcc: Only networks with this 3-digit mobile country code, for example 400.

Implementation

Future<MobileNetworkList?> commonGetMobileNetworks({ String? countryCode, String? mcc, Future<void>? abortTrigger, }) async {
  final response = await commonGetMobileNetworksWithHttpInfo(countryCode: countryCode, mcc: mcc, abortTrigger: abortTrigger,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MobileNetworkList',) as MobileNetworkList;

  }
  return null;
}