Err<T> class
final
Failed outcome carrying failure.
Properties
- failure → Failure
-
final
- failureOrNull → Failure?
-
The failure, or
nullfor 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
nullfor 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< transform(T value)) → Future<R> >Result< R> > -
Like flatMap, for an asynchronous
transform.inherited -
fold<
R> (R onFailure(Failure failure), R onSuccess(T value)) → R -
Runs
onFailurefor Err oronSuccessfor Ok and returns the outcome. Argument order matches dartz'sEither.fold(failure first).override -
getOrDefault(
T fallback) → T -
The success value, or
fallbackfor Err.inherited -
getOrElse(
T onFailure(Failure failure)) → T -
The success value, or the result of
onFailurefor 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
ifBusinessErrorfor 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
actionfor a failure and returns this result unchanged.inherited -
onOk(
void action(T value)) → Result< T> -
Runs
actionfor 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