Validators class

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

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 Properties

creditCard ValidatorFunction
Gets a validator that validates if the control's value is a valid credit card number.
no setter
email ValidatorFunction
Gets a validator that requires the control's value pass an email validation test.
no setter
number ValidatorFunction
Gets a validator that validates if control's value is a numeric value.
no setter
required ValidatorFunction
Gets a validator that requires the control have a non-empty value.
no setter
requiredTrue ValidatorFunction
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) ValidatorFunction
Gets a validator that requires any element of the control's iterable value satisfies test.
compare(String controlName, String compareControlName, CompareOption compareOption) ValidatorFunction
Gets a FormGroup validator that compares two controls in the group.
compose(List<ValidatorFunction> validators) ValidatorFunction
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<ValidatorFunction> validators) ValidatorFunction
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) ValidatorFunction
Gets a validator that requires the control's value contains all the values specified in values.
equals<T>(T value) ValidatorFunction
Gets a validator that requires the control's value to be equals to argument value.
max<T>(T max) ValidatorFunction
Gets a validator that requires the control's value to be less than or equal to max value.
maxLength(int maxLength) ValidatorFunction
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) ValidatorFunction
Gets a validator that requires the control's value to be greater than or equal to min value.
minLength(int minLength) ValidatorFunction
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}) ValidatorFunction
Gets a FormGroup validator that checks the controls controlName and matchingControlName have the same values.
pattern(Pattern pattern, {String validationMessage = ValidationMessage.pattern}) ValidatorFunction
Gets a validator that requires the control's value to match a regex pattern.