isAlphaNumber method
Checks if the number is a valid vanity (alpha) number such as 800 MICROSOFT. A valid vanity number will start with at least 3 digits and will have three or more alpha characters. This does not do region-specific checks - to work out if this number is actually valid for a region, it should be parsed and methods such as isPossibleNumberWithReason and isValidNumber should be used.
number
the number that needs to be checked.
isAlphaNumber returns true if the number is a valid vanity number.
Implementation
bool isAlphaNumber(String number) {
if (!isViablePhoneNumber(number)) {
// Number is too short, or doesn't match the basic phone number pattern.
return false;
}
StringBuffer strippedNumber = StringBuffer(number);
maybeStripExtension(strippedNumber);
return matchesEntirely(_validAlphaPhonePattern, strippedNumber.toString());
}