Err<T> class final

Failed outcome carrying failure.

Inheritance

Constructors

Err(Failure failure)
const

Properties

failure Failure
final
failureOrNull Failure?
The failure, or null for Ok.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
isErr bool
Whether this is an Err.
no setterinherited
isOk bool
Whether this is an Ok.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
The success value, or null for Err.
no setterinherited

Methods

flatMap<R>(Result<R> transform(T value)) Result<R>
Transforms the success value into a new Result (flatMap), keeping a failure untouched.
inherited
flatMapAsync<R>(Future<Result<R>> transform(T value)) Future<Result<R>>
Like flatMap, for an asynchronous transform.
inherited
fold<R>(R onFailure(Failure failure), R onSuccess(T value)) → R
Runs onFailure for Err or onSuccess for Ok and returns the outcome. Argument order matches dartz's Either.fold (failure first).
override
getOrDefault(T fallback) → T
The success value, or fallback for Err.
inherited
getOrElse(T onFailure(Failure failure)) → T
The success value, or the result of onFailure for Err.
inherited
map<R>(R transform(T value)) Result<R>
Transforms the success value, keeping a failure untouched.
inherited
mapAsync<R>(Future<R> transform(T value)) Future<Result<R>>
Like map, for an asynchronous transform.
inherited
mapBusiness<R>(Failure ifBusinessError, Result<R> onData(T data)) Result<R>
Transport-aware mapping: maps the success value while letting TransportFailures and CancelledFailures pass through UNCHANGED; substitutes ifBusinessError for any other failure so feature-specific copy is preserved for real server errors. (An offline or cancelled request is not a business error and must not be relabelled as one.)
inherited
mapErr(Failure transform(Failure failure)) Result<T>
Transforms the failure, keeping a success untouched.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onErr(void action(Failure failure)) Result<T>
Runs action for a failure and returns this result unchanged.
inherited
onOk(void action(T value)) Result<T>
Runs action for a success and returns this result unchanged — for side effects in a chain (.onOk(emit).onErr(log)).
inherited
toString() String
A string representation of this object.
override

Operators

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