InvalidAll<T, E> class
final
Represents a failed validation with multiple errors.
Used when collecting all errors instead of failing fast.
- Inheritance
-
- Object
- ValidationResult<
T, E> - InvalidAll
Constructors
-
InvalidAll(List<
E> errors) -
Creates an invalid result with multiple
errors.const
Properties
- errorOrNull → E?
-
Returns the first error if invalid, or
nullif valid.no setteroverride -
errors
→ List<
E> -
Returns all errors if invalid, or empty list if valid.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isInvalid → bool
-
Returns
trueif this result represents an invalid value.no setterinherited - isValid → bool
-
Returns
trueif this result represents a valid value.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueOrNull → T?
-
Returns the value if valid, or
nullif invalid.no setteroverride
Methods
-
fold<
R> ({required R onValid(T value), required R onInvalid(List< E> errors)}) → R -
Transforms this result by applying
onValidoronInvalid.override -
map<
R> (R transform(T value)) → ValidationResult< R, E> -
Maps the value if valid, returns same invalid result otherwise.
override
-
mapError<
E2> (E2 transform(E error)) → ValidationResult< T, E2> -
Maps the error(s) if invalid, returns same valid result otherwise.
Maps the error(s) if invalid, returns same valid result otherwise.
override
-
maybeWhen<
R> ({R valid(T value)?, R invalid(E error)?, R invalidAll(List< E> errors)?, required R orElse()}) → R -
Optional pattern matching with default fallback.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
when<
R> ({required R valid(T value), required R invalid(E error), required R invalidAll(List< E> errors)}) → R -
Exhaustive pattern matching.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override