jumpToPage method

void jumpToPage(
  1. int page
)

Changes which page is displayed in the controlled PageView.

Jumps the page position from its current value to the given value, without animation, and without checking if the new value is in range.

Implementation

void jumpToPage(int page) {
  final _PagePosition position = this.position as _PagePosition;
  if (position._cachedPage != null) {
    position._cachedPage = page.toDouble();
    return;
  }

  if (!position.hasViewportDimension) {
    position._pageToUseOnStartup = page.toDouble();
    return;
  }

  position.jumpTo(position.getPixelsFromPage(page.toDouble()));
}