showMenu static method
Plain menu with a Back option appended.
Implementation
static Future<int> showMenu(
String title,
List<String> options, {
int? defaultIndex,
String? fromStep,
}) async {
final List<String> withBack = <String>[
...options,
backOptionLabel,
];
final int chosen = await UserPrompt.showMenu(
title,
withBack,
defaultIndex: defaultIndex,
);
if (chosen == withBack.length - 1) {
throw BackNavigation(fromStep: fromStep);
}
return chosen;
}