ValueComparisonRule class

Validation rule that compares value to a constant.

See IValidationRule

Example

var schema =  Schema()
    .withRule( ValueComparisonRule('EQ', 1));

schema.validate(1);          // Result: no errors
schema.validate(2);          // Result: 2 is not equal to 1
Implemented types

Constructors

ValueComparisonRule(String operation, dynamic value)
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