getCountryByPhoneCode static method

Country getCountryByPhoneCode(
  1. String phoneCode
)

Implementation

static Country getCountryByPhoneCode(String phoneCode) {
  try {
    return countryList.firstWhere(
      (country) => country.phoneCode!.toLowerCase() == phoneCode.toLowerCase(),
    );
  } catch (error) {
    throw Exception(
        "The initialValue provided is not a supported phone code!");
  }
}