switchTo method

void switchTo(
  1. int index,
  2. int totalPages
)

Implementation

void switchTo(
  int index,
  int totalPages,
) {
  if (index == _currentIndex) return;

  _currentIndex = index;
  _markAsUsed(index);

  // _markAsUsed already calls _enforceMaxSize internally.
  // Only flush aggressively if disposeUnused is enabled.
  if (disposeUnused) {
    _flushMemoryCache();
  }

  notifyListeners();
}