Added getter errorMessages to reactive_form_field.dart
Connection with Issues
Close Issue: This pull request addresses and resolves issue #454.
Solution Description
The errorMessages getter has been implemented to retrieve a list of all error messages (in addition to the errorText getter, which only returns the first) associated with the FormControl bound to the widget. Here’s a detailed breakdown of the solution:
Error Condition: The getter checks if the control has errors and if the _showErrors flag is true.
If the 'required' error is present, the method returns a list containing the 'required' error message.
The error message is either a custom validation message (if provided) or the string 'required'.
Handling Other Errors:
If the 'required' error is not present, the method returns a list of all other error messages.
For each error key, it looks for a custom validation message.
If a custom validation message is found, it is used as the error message. Otherwise, the error key itself is used as the error message.
No Errors or Flag False: If the control has no errors or the _showErrors flag is false, an empty list is returned.
Result
This getter provides more extensive customization options for custom ReactiveTextFields.
Added getter errorMessages to reactive_form_field.dart
Connection with Issues
Solution Description
The errorMessages getter has been implemented to retrieve a list of all error messages (in addition to the errorText getter, which only returns the first) associated with the FormControl bound to the widget. Here’s a detailed breakdown of the solution:
Handling Other Errors:
Result
This getter provides more extensive customization options for custom
ReactiveTextFields
.