fromRaw static method

  1. @internal
PhoneNumber fromRaw(
  1. String phoneNumber
)

parses a phoneNumber given a countryCode

Use parseWithIsoCode when possible as multiple countries use the same country calling code.

This assumes the phone number starts with the country calling code

throws a PhoneNumberException if the country calling code is invalid

Implementation

@internal
static PhoneNumber fromRaw(String phoneNumber) {
  phoneNumber = TextParser.normalize(phoneNumber);
  phoneNumber = InternationalPrefixParser.removeInternationalPrefix(
    phoneNumber,
  );
  final countryCode = CountryCodeParser.extractCountryCode(phoneNumber);
  return fromCountryCode(countryCode, phoneNumber);
}