bankSearch function
Implementation
List<dynamic>? bankSearch(
List<dynamic>? bankList,
String? searchText,
) {
// search bankList json by bankName using searchText aphabert later
if (bankList == null || searchText == null || searchText.isEmpty) {
return bankList;
}
final filteredList = bankList.where((bank) {
final name = bank['bankName'].toString().toLowerCase();
final search = searchText.toLowerCase();
return name.contains(search);
}).toList();
return filteredList.isEmpty ? null : filteredList;
}