Validators class Null safety

Provides a set of built-in validators that can be used by form fields.

A validator is a function that processes a FormField and returns an error String or null. A null String means that validation has passed.

Constructors

Validators()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

compose(List<FormFieldValidator<String>> validators) FormFieldValidator<String>
Compose multiple validators into a single validator. [...]
email(String errorMessage) FormFieldValidator<String>
Validator that requires the field's value pass an email validation test. [...]
max(double max, String errorMessage) FormFieldValidator<String>
Validator that requires the field's value to be less than or equal to the provided number. [...]
maxLength(int maxLength, String errorMessage) FormFieldValidator<String>
Validator that requires the length of the field's value to be less than or equal to the provided maximum length. [...]
min(double min, String errorMessage) FormFieldValidator<String>
Validator that requires the field's value to be greater than or equal to the provided number. [...]
minLength(int minLength, String errorMessage) FormFieldValidator<String>
Validator that requires the length of the field's value to be greater than or equal to the provided minimum length. [...]
patternRegExp(RegExp pattern, String errorMessage) FormFieldValidator<String>
Validator that requires the field's value to match a regex pattern. [...]
patternString(String pattern, String errorMessage) FormFieldValidator<String>
Validator that requires the field's value to match a regex pattern. [...]
required(String errorMessage) FormFieldValidator<String>
Validator that requires the field have a non-empty value. [...]