searchCountries method

List<CountryModel> searchCountries(
  1. String query
)

Implementation

List<CountryModel> searchCountries(String query) {
  if (_countries == null) return [];
  final lowerQuery = query.toLowerCase();
  return _countries!.where((country) =>
    country.name.toLowerCase().contains(lowerQuery) ||
    country.sortName.toLowerCase().contains(lowerQuery)
  ).toList();
}