isCarrierSpecific method
Given a valid short number, determines whether it is carrier-specific (however, nothing is implied about its validity). Carrier-specific numbers may connect to a different end-point, or not connect at all, depending on the user's carrier. If it is important that the number is valid, then its validity must first be checked using isValidShortNumber or isValidShortNumberForRegion.
number
the valid short number to check
returns whether the short number is carrier-specific,
assuming the input was a valid short number
Implementation
bool isCarrierSpecific(PhoneNumber number) {
List<String> regionCodes =
_getRegionCodesForCountryCode(number.countryCode);
String? regionCode =
_getRegionCodeForShortNumberFromRegionList(number, regionCodes);
String nationalNumber = _getNationalSignificantNumber(number);
PhoneMetadata? phoneMetadata = _getShortNumberMetadataForRegion(regionCode);
return (phoneMetadata != null) &&
(_matchesPossibleNumberAndNationalNumber(
nationalNumber, phoneMetadata.carrierSpecific));
}