ValidationRule<T> class
abstract
Represents a validation rule that can be applied to a form field.
This abstract class defines the structure for creating custom validation rules for form fields.
- Implementers
- Alpha
- AlphaDash
- AlphaNum
- Between
- Boolean
- Date
- DateAfter
- DateBefore
- Different
- Digits
- DigitsBetween
- FileSizeRule
- FileTypeRule
- InList
- Integer
- IsFalse
- IsTrue
- MaxLength
- MaxSelected
- MaxValue
- MinLength
- MinSelected
- MinValue
- NotInList
- Numeric
- Optional
- PhoneNumber
- RangeSelected
- Regex
- Required
- RequiredIf
- Same
- Size
- Url
Constructors
- ValidationRule(String? _message)
- Creates a new instance of ValidationRule.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- l10n → ValidatorLocalizations
-
The ValidatorLocalizations instance used for localization of validation messages.
It's obtained through a service locator (
sl
) for convenience.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
message(
String fieldName) → String - Retrieves the validation message to be displayed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
T value, Map< String, FormFieldState> fields) → bool -
Validates the given
value
against the validation rule. -
validatorMessage(
String fieldName) → String - Retrieves the validator message for the field.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited