animateTo method
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,
);
}