Rule class abstract
Base class for creating validation rules.
Each rule must implement a validate method that returns true if valid,
or false if invalid.
- Implementers
- AcceptedRule
- ActiveUrlRule
- AfterRule
- AlphaDashRule
- AlphaNumRule
- AlphaRule
- ArrayRule
- BeforeRule
- BoolRule
- ConfirmedRule
- CreditCardRule
- DateFormatRule
- DateRule
- DifferentRule
- DigitsBetweenRule
- DigitsRule
- DistinctRule
- EmailRule
- EndsWithRule
- ExistsRule
- FileRule
- ImageRule
- InArrayRule
- InRule
- IntRule
- IpRule
- Ipv4Rule
- Ipv6Rule
- JsonRule
- MacAddressRule
- MapRule
- MaxFileSizeRule
- MaxItemsRule
- MaxRule
- MimesRule
- MinFileSizeRule
- MinItemsRule
- MinRule
- NotInArrayRule
- NullableRule
- NumericRule
- PasswordRule
- PhoneRule
- ProhibitedIfRule
- ProhibitedRule
- RegexRule
- RequiredIfRule
- RequiredRule
- SameRule
- SometimesRule
- StartsWithRule
- StringRule
- SubsetRule
- UniqueRule
- UrlRule
- UuidRule
Constructors
- Rule()
Properties
- customMessage ↔ String?
-
The error message to be returned if validation fails.
Can be overridden by the user.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signature → String
-
Returns the unique signature of the rule.
Defaults to the class name in snake_case (logic handled by registry usually, but good to have).
no setter
Methods
-
message(
ValidationContext context) → String - Returns the validation error message.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
passes(
ValidationContext context) → FutureOr< bool> -
Validates the value using the given
context. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited