setStatus method

void setStatus(
  1. int step,
  2. StepState? state
)

Sets or clears the state of a specific step.

Parameters:

  • step (int): zero-based step index to modify
  • state (StepState?): new state, or null to clear

Example:

// Mark step as failed
controller.setStatus(2, StepState.failed);

// Clear step state
controller.setStatus(2, null);

Implementation

void setStatus(int step, StepState? state) {
  Map<int, StepState> newStates = Map.from(value.stepStates);
  if (state == null) {
    newStates.remove(step);
  } else {
    newStates[step] = state;
  }
  value = StepperValue(
    stepStates: newStates,
    currentStep: value.currentStep,
  );
}