getCountryByPhoneCode static method

Country? getCountryByPhoneCode(
  1. String? phoneCode
)

Implementation

static Country? getCountryByPhoneCode(String? phoneCode) {
  try {
    if (phoneCode?.isEmpty != false) {
      return null;
    }
    return countryList.firstWhere(
          (country) =>
      country.phoneCode.toLowerCase() == phoneCode?.toLowerCase(),
    );
  } catch (error) {
    return null;
  }
}