Err<T, E extends BaseException> class
final
Failed result wrapper.
Constructors
- Err(E error)
-
Creates a failed result containing
error.const
Properties
- error → E
-
The contained error instance.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isErr → bool
-
Returns
truewhen this result contains an error.no setterinherited - isOk → bool
-
Returns
truewhen this result contains a value.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
andThen<
U> (Result< U, E> next(T value)) → Result<U, E> -
Chains another computation only when this result is successful.
inherited
-
andThenAsync<
U> (Future< Result< next(T value)) → Future<U, E> >Result< U, E> > -
Async variant of andThen for future-returning pipelines.
inherited
-
map<
U> (U f(T value)) → Result< U, E> -
Maps the inner value when successful, preserving errors.
inherited
-
mapAsync<
U> (Future< U> f(T value)) → Future<Result< U, E> > -
Available on Result<
Maps the success value using an async transformer, preserving errors.T, E> , provided by the ResultX extension -
mapErr<
F extends BaseException> (F f(E error)) → Result< T, F> -
Maps the error type when present, preserving successes.
inherited
-
match<
R> ({required R ok(T value), required R err(E error)}) → R -
Pattern matches on the result, invoking
okorerraccordingly.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unwrap(
) → T -
Unwraps the result, throwing if it contains an error.
inherited
-
unwrapOr(
T fallback) → T -
Returns the inner value or
fallbackwhen this is an error.inherited -
unwrapOrElse(
T f(E error)) → T -
Returns the inner value or computes one via
f.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited