WizardModel class

Wizard model for multi-step forms.

Example

final wizard = WizardModel(
  steps: [
    WizardStep.textInput(
      key: 'name',
      prompt: 'What is your name?',
    ),
    WizardStep.confirm(
      key: 'subscribe',
      prompt: 'Subscribe to newsletter?',
    ),
  ],
);

// In your update function:
switch (msg) {
  case WizardCompletedMsg(:final answers):
    print('Name: ${answers['name']}');
    print('Subscribe: ${answers['subscribe']}');
    return (this, Cmd.quit());
}
Inheritance

Constructors

WizardModel({required List<WizardStep> steps, String? title, bool showProgress = true})
Creates a wizard model.

Properties

answers Map<String, dynamic>
Gets the current answers.
no setter
currentStepIndex int
Gets the current step index.
no setter
currentVisibleStep int
Gets the current visible step number (1-indexed).
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showProgress bool
Whether to show progress (e.g., "Step 2 of 5").
final
steps List<WizardStep>
The wizard steps.
final
title String?
Optional title displayed at the top.
final
totalSteps int
Gets the total number of steps (excluding skipped ones).
no setter

Methods

init() Cmd?
Returns an optional command to execute on program startup.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update(Msg msg) → (WizardModel, Cmd?)
Updates the component state in response to a message.
override
view() String
Renders the current model state for display.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited