AbstractValidator<T> class abstract

Base class for creating validators for type T.

Extend this class to create a validator for your model.

Example:

class UserValidator extends AbstractValidator<User> {
  UserValidator() {
    ruleFor((user) => user.name).notEmpty();
    ruleFor((user) => user.email).emailAddress();
  }
}
Available extensions

Constructors

AbstractValidator()

Properties

cascadeMode CascadeMode
Default cascade mode for all rules.
getter/setter pair
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
ruleFor<TProperty>(TProperty? propertyFunc(T), {String? propertyName}) PropertyRule<T, TProperty>
Creates a new rule for the specified property.
ruleForEach<TElement>(List<TElement>? propertyFunc(T), {String? propertyName}) CollectionPropertyRule<T, TElement>
Creates rules for each item in a collection.
toString() String
A string representation of this object.
inherited
validate(T instance) ValidationResult
Validates the specified instance.
validateAsync(T instance) Future<ValidationResult>
Validates the specified instance asynchronously.
validateAsyncIsolate(T instance) Future<ValidationResult>

Available on AbstractValidator<T>, provided by the IsolateValidation extension

Valida una instancia de forma asíncrona en un isolate.
validateIsolate(T instance) Future<ValidationResult>

Available on AbstractValidator<T>, provided by the IsolateValidation extension

Valida una instancia en un isolate separado.
validateManyIsolate(List<T> instances) Future<List<ValidationResult>>

Available on AbstractValidator<T>, provided by the IsolateValidation extension

Valida múltiples instancias en un isolate.

Operators

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