search method
Filters the list based on the provided search text.
The search is case-insensitive and accent-insensitive, so searching for "medi" will match "Médico", "medico", "MEDICO", etc.
Implementation
void search(String? text) {
if (text == null || text.isEmpty) {
_listToShow = originalList;
notifyListeners();
return;
}
final normalizedSearch = text.toUpperCase().normalize();
_listToShow = originalList
.where((element) =>
element.title.toUpperCase().normalize().contains(normalizedSearch) ||
element.id.toUpperCase().normalize().contains(normalizedSearch))
.toList();
notifyListeners();
}