getProvinces static method
Gets the list of provinces.
Optionally filters by code or query.
Implementation
static List<Province> getProvinces({int? code, String? query}) {
return _provinces.where((province) {
final matchesCode = code == null || province.code == code;
final normalizedQuery = query != null ? removeDiacritics(query) : null;
final normalizedProvinceName = removeDiacritics(province.name);
final matchesQuery = normalizedQuery == null ||
normalizedProvinceName.contains(normalizedQuery);
return matchesCode && matchesQuery;
}).toList();
}