isViablePhoneNumber method

bool isViablePhoneNumber(
  1. String number
)

Checks to see if the string of characters could possibly be a phone number at all. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-number symbols have been removed, such as by the method extractPossibleNumber. number is the string to be checked for viability as a phone number. isViablePhoneNumber returns true if the number could be a phone number of some sort, otherwise false.

Implementation

bool isViablePhoneNumber(String number) {
  if (number.length < _minLengthForNsn) {
    return false;
  }
  return matchesEntirely(_validPhoneNumberPattern, number);
}