runWizard static method
Run a multi-step wizard process
Implementation
static Future<Map<String, dynamic>> runWizard(
String title,
List<WizardStep> steps,
) async {
final Map<String, dynamic> results = <String, dynamic>{};
DisplayPrompt.printBanner(title);
for (int i = 0; i < steps.length; i++) {
printStepIndicator(i, steps.length, steps[i].name);
final dynamic result = await steps[i].execute(results);
if (result == null && steps[i].required) {
warn('Step cancelled. Aborting wizard.');
return <String, dynamic>{};
}
results[steps[i].key] = result;
}
return results;
}