pageTo method

void pageTo(
  1. int rowIndex, [
  2. bool align = true
])

Ensures that the given row is visible. align params makes sure that starting index will be aligned to page size, e.g. if page size is 5, row with index 7 (ordinal number 8) is requested, rather than showing rows 8 - 12 starting page at row 7 it will make first row index 5 displaying 6-10

Implementation

void pageTo(int rowIndex, [bool align = true]) {
  final int oldFirstRowIndex = _firstRowIndex;
  setState(() {
    _firstRowIndex = align
        ? _alignRowIndex(rowIndex, _effectiveRowsPerPage)
        : math.max(math.min(_rowCount - 1, rowIndex), 0);
  });
  if ((widget.onPageChanged != null) &&
      (oldFirstRowIndex != _firstRowIndex)) {
    widget.onPageChanged!(_firstRowIndex);
  }
}