PhoneNumber constructor
Create PhoneNumber instance using given country
and nationalNumber
Implementation
factory PhoneNumber(Country? country, String? nationalNumber) {
if (country == null && nationalNumber == null) {
return empty.clone();
}
final String normalizedNationalNumber = normalize(nationalNumber ?? '');
return PhoneNumber._(
country: country,
nationalNumber: normalizedNationalNumber,
formattedNumber: country == null
? normalizedNationalNumber
: '+${country.prefix}$normalizedNationalNumber',
isValid:
country?.isValidNationalNumber(normalizedNationalNumber) ?? false,
);
}