findByCode method

Country? findByCode(
  1. String? code
)

Returns the first country that mach the given code.

Implementation

Country? findByCode(String? code) {
  final uppercaseCode = code?.toUpperCase();
  return _countries
      .firstWhereOrNull((country) => country.countryCode == uppercaseCode);
}