AndRule class

Validation rule to combine rules with AND logical operation. When all rules returns no errors, than this rule also returns no errors. When one of the rules return errors, than the rules returns all errors.

See IValidationRule

Example

var schema =  Schema()
    .withRule( AndRule(
         ValueComparisonRule('GTE', 1),
         ValueComparisonRule('LTE', 10)
    ));

schema.validate(0);          // Result: 0 must be greater or equal to 1
schema.validate(5);          // Result: no error
schema.validate(20);         // Result: 20 must be letter or equal 10
Implemented types

Constructors

AndRule(List<IValidationRule>? rules)
Creates a new validation rule and sets its values.

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
validate(String? path, Schema schema, dynamic value, List<ValidationResult> results) → void
Validates a given value against this rule.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited