ListProvider<T> constructor

ListProvider<T>({
  1. PagingController<T>? pagingController,
  2. FilterController<T>? filterController,
  3. Widget? noData,
})

Implementation

ListProvider({
  this.pagingController,
  this.filterController,
  this.noData,
}) {
  helper = pagingController?.pagingHelper;
  pagingController?.addListener(() {
    setListType(ListType.PAGING);
    notifyListeners();
  });
  filterController?.addListener(() {
    if (filterController!.searchQuery.isEmpty) {
      setListType(ListType.PAGING);
    }
    if (filterController?.filterStatus == FilterStatus.FILTER_IDLE &&
        filterController?.listStatus == ListStatus.IDLE) {
      setListType(ListType.PAGING);
    } else if (
        // filterController?.filterStatus == FilterStatus.FILTER_LOADED &&
        filterController?.listStatus != ListStatus.IDLE) {
      setListType(ListType.FILTERING);
    }
    notifyListeners();
  });
}