getRegionInfoFromPhoneNumber static method

Future<PhoneNumberTest> getRegionInfoFromPhoneNumber(
  1. String phoneNumber, [
  2. String isoCode = ''
])

Implementation

static Future<PhoneNumberTest> getRegionInfoFromPhoneNumber(
  String phoneNumber, [
  String isoCode = '',
]) async {
  RegionInfo regionInfo = await PhoneNumberUtil.getRegionInfo(
      phoneNumber: phoneNumber, isoCode: isoCode);

  String? internationalPhoneNumber =
      await PhoneNumberUtil.normalizePhoneNumber(
    phoneNumber: phoneNumber,
    isoCode: regionInfo.isoCode ?? isoCode,
  );

  return PhoneNumberTest(
      phoneNumber: internationalPhoneNumber,
      dialCode: regionInfo.regionPrefix,
      isoCode: regionInfo.isoCode);
}