stringSearch method

List<Country> stringSearch(
  1. String search
)

Implementation

List<Country> stringSearch(String search) {
  search = removeDiacritics(search.toLowerCase());
  return where(
    (country) => isNumeric(search) || search.startsWith("+")
        ? country.dialCode.contains(search)
        : removeDiacritics(country.name.replaceAll("+", "").toLowerCase())
                .contains(search) ||
            country.nameTranslations.values.any((element) =>
                removeDiacritics(element.toLowerCase()).contains(search)),
  ).toList();
}