loadCountries static method

List<Country> loadCountries()

Loads and returns all countries from the data source.

The countries are automatically sorted alphabetically by name. Results are cached after the first load to improve performance on subsequent calls.

Returns a List<Country> containing all 195 UN-recognized countries.

Implementation

static List<Country> loadCountries() {
  if (_countries != null) return _countries!;

  return allCountries()..sort((a, b) => a.name.compareTo(b.name));
}