next method
void
next()
Moves to the next step in the form.
Validates the current step before moving to the next step.
If there are no more steps, it calls the submit method.
Implementation
void next() {
if (_isCurrentStepValid) {
final nextStep = state.currentStep + 1;
if (nextStep < steps.length) {
// Move to the next step
state = state.copyWith(currentStep: nextStep);
} else {
// If there are no more steps, submit the form
submit();
}
}
}