fetchNextPage method

Future<void> fetchNextPage()

Fetch the next set of items from the same search

Implementation

Future<void> fetchNextPage() async {
  if (_timer?.isActive == true) {
    // already processing another request
    return;
  }

  _startTimer();

  if (state.hasNoMoreItems) {
    return;
  } else if (state.type == PaginatedStateType.onGoingLoading) {
    return;
  }

  _printDebugLog('PaginatedSearchController.fetchNextBatch');

  // use the same query to fetch the next items in search
  // show ongoing loading
  state = state.copyWith(type: PaginatedStateType.onGoingLoading);

  _performSearch();
}