fromCode static method

Country? fromCode(
  1. String code
)

Find country by code

Implementation

static Country? fromCode(String code) {
  try {
    return Country.values.firstWhere(
      (country) => country.code.toLowerCase() == code.toLowerCase(),
    );
  } catch (e) {
    return null;
  }
}