OrRule class
Validation rule to combine rules with OR logical operation. When one of rules returns no errors, than this rule also returns no errors. When all rules return errors, than the rule returns all errors.
See IValidationRule
Example
var schema = Schema()
.withRule( OrRule(
ValueComparisonRule('LT', 1),
ValueComparisonRule('GT', 10)
));
schema.validate(0); // Result: no error
schema.validate(5); // Result: 5 must be less than 1 or 5 must be more than 10
schema.validate(20); // Result: no error
- Implemented types
Constructors
-
OrRule(List<
IValidationRule> rules) - Creates a new validation rule and sets its values. [...]
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
validate(
String path, Schema schema, dynamic value, List< ValidationResult> results) → void -
Validates a given value against this rule. [...]
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited