animateTo method

void animateTo(
  1. int newIndex
)

Implementation

void animateTo(int newIndex) {
  final int clamped = newIndex.clamp(0, _length - 1);
  if (clamped == _index) return;
  _index = clamped;
  notifyListeners();
}