findByCode static method

Country findByCode(
  1. String code
)

Returns a Country by its name code

Throws an exception if the country could not be found

Implementation

static Country findByCode(String code) {
  return _list.firstWhere(
    (country) => country.code == code,
    orElse: () {
      throw CountryNotFoundException(code);
    },
  );
}