flutterdartflutter-form-builder

How can i change default error arabic Text message in form_builder_validators


I want to change this text to my custom text in all form builder validators in the app.

enter image description here


Solution

  • You can use this package form_builder_validators which you can pass your custom error text like this

    FormBuilderValidators.required(errorText: "hello world")
    

    here an example

    Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: FormBuilder(
                    key: _formKey,
                    autovalidateMode: AutovalidateMode.always,
                    child:  FormBuilderTextField(
                      name: 'email',
                      decoration: const InputDecoration(labelText: 'Email'),
                      validator:  FormBuilderValidators.required(errorText: "hello world"),
                    ),
                  ),
                ),