Validate class abstract final

Static factory class for creating validators.

Provides a clean, readable API for common patterns:

final validator = Validate.all<String, String>([
  rule1,
  rule2,
]);

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

Operators

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

Static Methods

all<T, E>(List<Formix<T, E>> validators) Formix<T, E>
Creates a validator that requires ALL rules to pass (AND logic).
allCollect<T, E>(List<Formix<T, E>> validators) Formix<T, E>
Creates a validator that requires ALL rules to pass, collecting all errors.
allCollectLimited<T, E>(List<Formix<T, E>> validators, {int maxErrors = 5}) Formix<T, E>
Creates a validator that requires ALL rules to pass, collecting up to maxErrors errors.
any<T, E>(List<Formix<T, E>> validators, {E? fallbackError}) Formix<T, E>
Creates a validator that requires AT LEAST ONE rule to pass (OR logic).
cached<T, E>(Formix<T, E> validator) CachedFormix<T, E>
Creates a single-value cached validator wrapper.
chain<T, E>(List<Formix<T, E>> validators) Formix<T, E>
Creates a validator that chains validators sequentially.
lazy<T, E>(Formix<T, E> factory()) LazyFormix<T, E>
Creates a lazy validator that defers instantiation until first use.
lruCached<T, E>(Formix<T, E> validator, {int maxSize = 10}) LruCachedFormix<T, E>
Creates an LRU cached validator wrapper.
transform<TIn, TOut, E>({required TOut? transform(TIn value), required E onNull, required Formix<TOut, E> then}) Formix<TIn, E>
Creates a transform validator that parses input before validation.
when<T, E>({required bool condition(T value), required Formix<T, E> then, Formix<T, E>? orElse}) Formix<T, E>
Creates a conditional validator.