Validators class
Provides a set of built-in validators that can be used by form controls, form groups, and form arrays.
Constructors
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 Properties
- creditCard → Validator
-
Gets a validator that validates if the control's value is a valid
credit card number.
no setter
- email → Validator
-
Gets a validator that requires the control's value pass an email
validation test.
no setter
- number → Validator
-
Gets a validator that validates if control's value is a numeric value.
no setter
- required → Validator
-
Gets a validator that requires the control have a non-empty value.
no setter
- requiredTrue → Validator
-
Gets a validator that requires the control's value be true.
This validator is commonly used for required checkboxes.
no setter
Static Methods
-
any<
T> (AnyValidatorFunctionTest< T> test) → Validator -
Gets a validator that requires any element of the control's iterable value
satisfies
test
. -
compare(
String controlName, String compareControlName, CompareOption compareOption) → Validator - Gets a FormGroup validator that compares two controls in the group.
-
compose(
List< Validator> validators) → Validator - Compose multiple validators into a single validator that returns the union of the individual error maps for the provided control of multiple validators.
-
composeOR(
List< Validator> validators) → Validator - Compose multiple validators into a single validator that returns the union of the individual error maps for the provided control of multiple validators.
-
contains<
T> (List< T> values) → Validator -
Gets a validator that requires the control's value contains all the
values specified in
values
. -
delegate(
ValidatorFunction validator) → Validator -
Gets a validator that delegates the validation to the external
validator
function. -
delegateAsync(
AsyncValidatorFunction validator) → AsyncValidator -
Gets a validator that delegates the validation to the external
asynchronous
validator
function. -
equals<
T> (T value) → Validator -
Gets a validator that requires the control's value to be equals to
argument
value
. -
max<
T> (T max) → Validator -
Gets a validator that requires the control's value to be less than
or equal to
max
value. -
maxLength(
int maxLength) → Validator -
Gets a validator that requires the length of the control's value to be
less than or equal to the provided
maxLength
. -
min<
T> (T min) → Validator -
Gets a validator that requires the control's value to be greater than
or equal to
min
value. -
minLength(
int minLength) → Validator -
Gets a validator that requires the length of the control's value to be
greater than or equal to the provided
minLength
. -
mustMatch(
String controlName, String matchingControlName, {bool markAsDirty = true}) → Validator -
Gets a FormGroup validator that checks the controls
controlName
andmatchingControlName
have the same values. -
pattern(
Pattern pattern, {String validationMessage = ValidationMessage.pattern}) → Validator -
Gets a validator that requires the control's value to match a
regex
pattern
.