parse static method
Parses a phone number given caller or destination information.
The logic is:
- Remove the international prefix / exit code a. if caller is provided remove the international prefix / exit code b. if caller is not provided be a best guess is done with a possible destination country
- Find destination country a. if no destination country was provided, the destination is assumed to be the same as the caller b. if no caller was provided a best guess is estimated by looking at the first digits to see if they match a country. Since multiple countries share the same country code, pattern matching might be used when there are multiple matches.
- Extract the country code with the country information
- Transform a local NSN to an international version
Implementation
static PhoneNumber parse(
String phoneNumber, {
IsoCode? callerCountry,
IsoCode? destinationCountry,
}) =>
PhoneParser.parse(
phoneNumber,
callerCountry: callerCountry,
destinationCountry: destinationCountry,
);