validator property

FormFieldValidator<String>? validator
final

An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.

The returned value is exposed by the FormFieldState.errorText property. It transforms the text using errorBuilder.

Alternating between error and normal state can cause the height of the FTextField to change if no other subtext decoration is set on the field. To create a field whose height is fixed regardless of whether or not an error is displayed, wrap the FTextField in a fixed height parent like SizedBox.

Implementation

final FormFieldValidator<String>? validator;