Failure<T, E> class final

A failed result containing error.

Inheritance

Constructors

Failure(E error)
const

Properties

error → E
The error value.
final
errorOrNull → E?
Returns the error or null.
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
isFailure bool
Whether this result is a failure.
no setterinherited
isSuccess bool
Whether this result is a success.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
Returns the success value or null.
no setteroverride
valueOrThrow → T
Returns the success value or throws the error.
no setteroverride

Methods

flatMap<R>(Result<R, E> transform(T value)) Result<R, E>
Chains another operation that returns a Result.
override
getOrElse(T orElse(E error)) → T
Returns the success value or computes a fallback from the error.
override
map<R>(R transform(T value)) Result<R, E>
Maps the success value using transform, leaving failures unchanged.
override
mapError<R>(R transform(E error)) Result<T, R>
Maps the error using transform, leaving successes unchanged.
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 success(T value), required R failure(E error)}) → R
Pattern-matches on success or failure, returning a result of type R.
override

Operators

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