getCountryFromCode method

CountriesModel? getCountryFromCode(
  1. String countryCode
)

Retrieves a CountriesModel by its countryCode.

If no country is found with the provided countryCode, returns null.

Implementation

CountriesModel? getCountryFromCode(String countryCode) {
  CountriesModel? dd =
      where((e) => e.code.toLowerCase() == countryCode.toLowerCase())
          .firstOrNull;
  return dd;
}