isPossibleShortNumberForRegion method
Check whether a short number is a possible number when dialed from the given region. This provides a more lenient check than isValidShortNumberForRegion.
number
the short number to check
regionDialingFrom
the region from which the number is dialed
returns whether the number is a possible short number
Implementation
bool isPossibleShortNumberForRegion(
PhoneNumber number, String regionDialingFrom) {
if (!_regionDialingFromMatchesNumber(number, regionDialingFrom)) {
return false;
}
PhoneMetadata? phoneMetadata =
_getShortNumberMetadataForRegion(regionDialingFrom);
if (phoneMetadata == null) {
return false;
}
int numberLength = _getNationalSignificantNumber(number).length;
return phoneMetadata.generalDesc.possibleLength.contains(numberLength);
}