getListSearch method
Future<Stream<ResponseDataDataSource> >
getListSearch(
- String text,
- int limit,
- int offset,
- SelectModel? selectModel, {
- Map? data,
- bool? refresh = false,
- TypeSearch typeSearch = TypeSearch.CONTAINS,
- ItemSort? itemSort,
Implementation
@override
Future<Stream<ResponseDataDataSource>> getListSearch(
String text, int limit, int offset, SelectModel? selectModel,
{Map? data,
bool? refresh = false,
TypeSearch typeSearch = TypeSearch.CONTAINS,
ItemSort? itemSort}) async {
if (listAll == null || listAll!.isEmpty || refresh == true) {
listAll = await fetchData(limit, offset, selectModel, data: data);
}
List<Map<String, dynamic>>? tempList =
applyFilterList(typeSearch, listAll!, text);
tempList = applySort(itemSort, selectModel!.id, tempList);
List<Map<String, dynamic>> subList = getSubList(offset, limit, tempList);
return Stream.value(ResponseDataDataSource(
total: tempList!.length,
data: generateList(subList, offset, selectModel),
start: offset,
end: offset + limit,
filter: text));
}