filterSearchResults method
void
filterSearchResults(
- String query
)
Implementation
void filterSearchResults(String query) {
RxList<CustomerData> dummySearchList = <CustomerData>[].obs;
dummySearchList.addAll(tempAllCustomers);
if (query.isNotEmpty) {
RxList<CustomerData> dummyListData = <CustomerData>[].obs;
for (var item in dummySearchList) {
if (item.firstName!.toLowerCase().contains(query) ||
item.firstName!.toUpperCase().contains(query) ||
item.lastName!.toLowerCase().contains(query) ||
item.lastName!.toUpperCase().contains(query)) {
dummyListData.add(item);
}
}
allCustomers.clear();
allCustomers.addAll(dummyListData);
update();
return;
} else {
allCustomers.clear();
allCustomers.addAll(tempAllCustomers);
update();
}
}