File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ class Switch with Tools implements Component<Result<bool>> {
18
18
String ? errorMessage;
19
19
late final String exitMessage;
20
20
21
- final allowedYesValues = ['yes' , 'y' ];
22
- final allowedNoValues = ['no' , 'n' ];
21
+ final List < String > allowedYesValues = ['yes' , 'y' ];
22
+ final List < String > allowedNoValues = ['no' , 'n' ];
23
23
24
24
final _completer = Completer <Result <bool >>();
25
25
@@ -32,12 +32,15 @@ class Switch with Tools implements Component<Result<bool>> {
32
32
required this .answer,
33
33
this .defaultValue,
34
34
String ? exitMessage,
35
+ List <String >? allowedYesValues,
36
+ List <String >? allowedNoValues,
35
37
}) {
36
- this .exitMessage =
37
- exitMessage ?? '${AsciiColors .red ('✘' )} Operation canceled by user' ;
38
+ this .exitMessage = exitMessage ?? '${AsciiColors .red ('✘' )} Operation canceled by user' ;
38
39
if (defaultValue != null ) {
39
40
value = defaultValue! ;
40
41
}
42
+ this .allowedNoValues.addAll (allowedNoValues ?? []);
43
+ this .allowedYesValues.addAll (allowedYesValues ?? []);
41
44
}
42
45
43
46
/// Handles the switch component and returns a [Future] that completes with the result of the switch.
You can’t perform that action at this time.
0 commit comments