AtLeastOneExistsRule class

Validation rule that check that at least one of the object properties is not null.

See IValidationRule

Example

var schema =  Schema()
    .withRule( AtLeastOneExistsRule('field1', 'field2'));

schema.validate({ field1: 1, field2: 'A' });     // Result: no errors
schema.validate({ field1: 1 });                  // Result: no errors
schema.validate({ });                            // Result: at least one of properties field1, field2 must exist
Implemented types

Constructors

AtLeastOneExistsRule(List<String> properties)
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