getList method
Future<Stream<ResponseDataDataSource> >
getList(
- int limit,
- int offset,
- SelectModel? selectModel, {
- Map? data,
- bool refresh = false,
- ItemSort? itemSort,
- GroupFilterExp? filter,
Implementation
@override
Future<Stream<ResponseDataDataSource>> getList(
int limit,
int offset,
SelectModel? selectModel, {
Map? data,
bool refresh = false,
ItemSort? itemSort,
GroupFilterExp? filter,
}) async {
if (listAll == null ||
listAll!.isEmpty ||
refresh == true ||
// Caso o itemSort tenha sido anulado, atualiza a lista para restaurar a formatação padrão
(itemSort == null && _currentSort != null)) {
listAll?.clear();
listAll = await fetchData(limit, offset, selectModel, data: data);
}
if (itemSort != _currentSort) {
listAll = applySort(itemSort, selectModel!.id, listAll);
}
List<Map<String, dynamic>> tempList = applyFilters(listAll!, filter);
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));
}