feat: [mason_logger] support validation for `prompt`, `promptAny`, and `chooseAny`
**Description**
`Logger` has some user inputs that accept arbitrary data. It can be useful to validate that user input "inline" with a given user input without having to re-prompt the user for an input.
**Requirements**
- [ ] define `Validator<T>` typedef like [Flutter's `FormFieldValidator`](https://api.flutter.dev/flutter/widgets/FormFieldValidator.html)<T>.
- [ ] add optional `Validator<String>? validator` parameter to `Logger.prompt`
- [ ] add optional `Validator<List<String>>? validator` parameter to `Logger.promptAny`
- [ ] add optional `Validator<List<T>>? validator` parameter to `Logger.chooseAny`
**Additional Context**
> Why these methods?
I think these are the only places a validation makes sense since data types are not very constrained compored to the other inputs.
- `chooseOne` is already very limiting with select one (how would you validate "one" item?).
- `confirm`'s return value is it's "validation" by nature of booleans. "Inline" validation does seem to provide any additional information to the user.
> How would this work?
```dart
void collectInput() {
String value =
}
0 条评论