isNumberGeographical method

bool isNumberGeographical({
  1. PhoneNumber? phoneNumber,
  2. PhoneNumberType? phoneNumberType,
  3. int? countryCallingCode,
})

Tests whether a phone number has a geographical association. It checks if the number is associated with a certain region in the country to which it belongs. Note that this doesn't verify if the number is actually in use.

phoneNumber The phone number to test.

Implementation

bool isNumberGeographical(
    {PhoneNumber? phoneNumber,
    PhoneNumberType? phoneNumberType,
    int? countryCallingCode}) {
  if (phoneNumber != null) {
    phoneNumberType = getNumberType(phoneNumber);
    countryCallingCode = phoneNumber.countryCode;
  }

  return phoneNumberType == PhoneNumberType.fixedLine ||
      phoneNumberType == PhoneNumberType.fixedLineOrMobile ||
      (_geoMobileCountries.contains(countryCallingCode) &&
          phoneNumberType == PhoneNumberType.mobile);
}