goToPage method

void goToPage(
  1. int page, {
  2. bool pageStartsFromZero = false,
})

Goes to the specified page

This method will await the onChangePage callback, if provided. Furthermore, if the callback returns a new List of items, those will be shown, otherwise the initial items paged will be shown.

Implementation

void goToPage(int page, {bool pageStartsFromZero = false}) async {
  currentPage = page + (pageStartsFromZero ? 1 : 0);
  var newItems = await onChangePage?.call(currentPage, rowsToShow);
  setItems(newItems ?? dataItems,
      replace: newItems != null && mode != TableMode.paginationScroll,
      reload: true);
}