animateTo method

Future<void> animateTo(
  1. int index, {
  2. Duration? duration,
  3. Curve? curve,
})

Animates to a specific list index

index - The index of the list to animate to duration - Animation duration (defaults to 400ms) curve - Animation curve (defaults to Curves.ease)

Implementation

Future<void> animateTo(int index, {
  Duration? duration,
  Curve? curve,
}) async {
  await _controller.animateToList(
    index,
    duration: duration ?? const Duration(milliseconds: 400),
    curve: curve ?? Curves.ease,
  );
}