isPossibleNumber method

bool isPossibleNumber(
  1. PhoneNumber number
)

Convenience wrapper around isPossibleNumberWithReason. Instead of returning the reason for failure, this method returns true if the number is either a possible fully-qualified number (containing the area code and country code), or if the number could be a possible local number (with a country code, but missing an area code). Local numbers are considered possible if they could be possibly dialled in this format: if the area code is needed for a call to connect, the number is not considered possible without it.

number the number that needs to be checked isPossibleNumber returns true if the number is possible

Implementation

bool isPossibleNumber(PhoneNumber number) {
  ValidationResult result = isPossibleNumberWithReason(number);
  return result == ValidationResult.isPossible ||
      result == ValidationResult.isPossibleLocalOnly;
}