next method

void next()

Moves to the next page in the sequence.

Implementation

void next() {
  final nextIndex = currentIndex + 1;
  if (_validateOnPageChange(nextIndex)) {
    setPage(nextIndex, true); // Animate to the next page
  } else {
    onDone(); // If at the last page, trigger the `onDone` callback
  }
}