lookup method
As per _lookup(long)
, but receives the number as a PhoneNumber
instead of a long.
number
the phone number to look up
returns the description corresponding to the prefix that best matches this
phone number
Implementation
String? lookup({PhoneNumber? phoneNumber, int? number}) {
if (number != null) {
return _lookup(number);
}
if (phoneNumber != null) {
String nationalSignificantNumber =
_phoneUtil.getNationalSignificantNumber(phoneNumber);
int phonePrefix =
int.parse('${phoneNumber.countryCode}$nationalSignificantNumber');
return _lookup(phonePrefix);
}
return null;
}