CollectionPropertyRule<T, TElement> class

Represents a validation rule for a collection property.

Inheritance
Available extensions

Constructors

CollectionPropertyRule(List<TElement>? propertyFunc(T), String propertyName)

Properties

hashCode int
The hash code for this object.
no setterinherited
propertyFunc List<TElement>? Function(T)
Function to extract the property value from the instance.
finalinherited
propertyName String
Name of the property being validated.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validators List<PropertyValidator<T, List<TElement>>>
List of validators for this property.
finalinherited

Methods

addValidator(PropertyValidator<T, List<TElement>> validator) → void
Adds a validator to this rule.
inherited
cascadeMode(CascadeMode mode) PropertyRule<T, List<TElement>>
Sets the cascade mode for this rule.
inherited
exactLength(int length) PropertyRule<T, List<TElement>>

Available on PropertyRule<T, List<TElement>>, provided by the CollectionValidatorExtensions extension

Ensures the collection has an exact number of items.
maxLength(int max) PropertyRule<T, List<TElement>>

Available on PropertyRule<T, List<TElement>>, provided by the CollectionValidatorExtensions extension

Ensures the collection has a maximum number of items.
minLength(int min) PropertyRule<T, List<TElement>>

Available on PropertyRule<T, List<TElement>>, provided by the CollectionValidatorExtensions extension

Ensures the collection has a minimum number of items.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notEmpty() PropertyRule<T, List<TElement>>

Available on PropertyRule<T, List<TElement>>, provided by the CollectionValidatorExtensions extension

Ensures the collection is not empty.
setValidator(AbstractValidator<TElement> validator) CollectionPropertyRule<T, TElement>
Sets a validator for each item in the collection.
toString() String
A string representation of this object.
inherited
unless(bool condition(T)) PropertyRule<T, List<TElement>>
Sets a condition for this rule NOT to execute.
inherited
validate(ValidationContext<T> context) List<ValidationFailure>
Validates this rule synchronously.
override
validateAsync(ValidationContext<T> context) Future<List<ValidationFailure>>
Validates this rule asynchronously.
override
when(bool condition(T)) PropertyRule<T, List<TElement>>
Sets a condition for this rule to execute.
inherited
withMessage(String message) PropertyRule<T, List<TElement>>
Sets a custom error message for the next validator.
inherited

Operators

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