fromName static method

CountryInfo fromName(
  1. String name
)

Get country by name (like 'Pakistan')

Implementation

static CountryInfo fromName(String name) {
  return _countries.values.firstWhere(
    (c) => c.name.toLowerCase() == name.toLowerCase(),
    orElse: () => const CountryInfo(
      name: 'Unknown',
      code: 'N/A',
      currency: 'N/A',
      phoneCode: 'N/A',
    ),
  );
}