filter method

List<CountriesModel> filter(
  1. String v
)

Filters the list of CountriesModel based on a search value v.

Returns a list of countries whose name starts with the search value or whose dial code contains the search value.

Implementation

List<CountriesModel> filter(String v) {
  return where((e) {
    return e.name.trim().toLowerCase().startsWith(v.trim().toLowerCase()) ||
        e.dialCode.contains(v);
  }).toList();
}