DEV Community

Discussion on: Why use Reactive Forms in Flutter?

Collapse
 
joanpablo profile image
Joan Pablo • Edited

Hi John Lester,

You can add a ControlValueAccessor to the reactive text field with the format.
In the Wiki you have an example of how to do that.

To add a validation message you just supply the validationMessages callback method in ReactiveTextField and return a Map with the messages:

ReactiveTextField(
   formControlName: 'email',
   validationMessages: (control) => {
      ValidationMessage.required: 'The email must not be empty',
      ValidationMessage.email: 'The email value must be a valid email'
   },
),
Enter fullscreen mode Exit fullscreen mode