refresh method

Future<void> refresh(
  1. PageFetcher<T> fetcher,
  2. int limit
)

Resets the controller back to page 1 and fetches the first page.

Call this to implement pull-to-refresh behaviour.

Implementation

Future<void> refresh(PageFetcher<T> fetcher, int limit) async {
  _currentPage = 1;
  _items.clear();
  _hasReachedEnd = false;
  _hasError = false;
  lastError = null;
  await _fetch(fetcher, limit);
}