Validators class

Provides a set of validators used by form controls.

A validator is a function that processes a Control or collection of controls and returns a map of errors. A null map means that validation has passed.

Example

Control loginControl = new Control("", Validators.required)

Constructors

Validators()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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<ValidatorFn?>? validators) ValidatorFn?
Compose multiple validators into a single function that returns the union of the individual error maps.
maxLength(num maxLength) ValidatorFn
Validator that requires controls to have a value of a maximum length.
minLength(num minLength) ValidatorFn
Validator that requires controls to have a value of a minimum length.
nullValidator(AbstractControl c) Map<String, bool>?
No-op validator.
pattern(String pattern) ValidatorFn
Validator that requires a control to match a regex to its value.
required(AbstractControl control) Map<String, bool>?
Validator that requires controls to have a non-empty value.