getRegionCodeForCountryCode method

String getRegionCodeForCountryCode(
  1. int countryCallingCode
)

Returns the region code that matches the specific country calling code. In the case of no region code being found, ZZ will be returned. In the case of multiple regions, the one designated in the metadata as the 'main' region for this calling code will be returned.

countryCallingCode the country calling code.

Implementation

String getRegionCodeForCountryCode(int countryCallingCode) {
  List<String>? regionCodes =
      _metadataMapLoader.countryCodeToRegionCodeMap['$countryCallingCode'];
  return regionCodes == null ? _unknownRegion : regionCodes[0];
}