Result<T extends Object> class sealed

A Outcome that represents the result of an operation: every Result is either Ok and contains a success value, or Err and contains an error value.

Inheritance
Implemented types
Available extensions

Properties

hashCode → int
The hash code for this object.
no setterinherited
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
value → Object
no setterinherited

Methods

asResult() → Result<T>
Returns this as a base Result type.
end() → void
Suppresses the linter error must_use_outcome.
override
err() → Option<Err<T>>
Safely gets the Err instance. Returns a Some on Err, or a None on Ok.
errOr(Result<T> other) → Result<T>
Returns this if it's Err, otherwise returns the other Result.
flatMap<R extends Object>(Result<R> noFutures(T value)) → Result<R>
Maps a Result<T> to Result<R> by applying a function that returns another Result.
flatten() → Result<T>

Available on Result<Result<Result<Result<Result<Result<Result<Result<Result<T>>>>>>>>>, provided by the FlattenResultExt9 extension

flatten() → Result<T>

Available on Result<Result<T>>, provided by the FlattenResultExt2 extension

flatten() → Result<T>

Available on Result<Result<Result<T>>>, provided by the FlattenResultExt3 extension

flatten() → Result<T>

Available on Result<Result<Result<Result<T>>>>, provided by the FlattenResultExt4 extension

flatten() → Result<T>

Available on Result<Result<Result<Result<Result<T>>>>>, provided by the FlattenResultExt5 extension

flatten() → Result<T>

Available on Result<Result<Result<Result<Result<Result<T>>>>>>, provided by the FlattenResultExt6 extension

flatten() → Result<T>

Available on Result<Result<Result<Result<Result<Result<Result<T>>>>>>>, provided by the FlattenResultExt7 extension

flatten() → Result<T>

Available on Result<Result<Result<Result<Result<Result<Result<Result<T>>>>>>>>, provided by the FlattenResultExt8 extension

flatten2() → Result<T>

Available on Result<Result<T>>, provided by the FlattenResultExt2 extension

flatten3() → Result<T>

Available on Result<Result<Result<T>>>, provided by the FlattenResultExt3 extension

flatten4() → Result<T>

Available on Result<Result<Result<Result<T>>>>, provided by the FlattenResultExt4 extension

flatten5() → Result<T>

Available on Result<Result<Result<Result<Result<T>>>>>, provided by the FlattenResultExt5 extension

flatten6() → Result<T>

Available on Result<Result<Result<Result<Result<Result<T>>>>>>, provided by the FlattenResultExt6 extension

flatten7() → Result<T>

Available on Result<Result<Result<Result<Result<Result<Result<T>>>>>>>, provided by the FlattenResultExt7 extension

flatten8() → Result<T>

Available on Result<Result<Result<Result<Result<Result<Result<Result<T>>>>>>>>, provided by the FlattenResultExt8 extension

flatten9() → Result<T>

Available on Result<Result<Result<Result<Result<Result<Result<Result<Result<T>>>>>>>>>, provided by the FlattenResultExt9 extension

fold(Result<Object>? onOk(Ok<T> ok), Result<Object>? onErr(Err<T> err)) → Result<Object>
Folds the two cases of this Result into a single new Result.
ifErr(void noFutures(Result<T> self, Err<T> err)) → Result<T>
Performs a side-effect with the contained error if this is an Err.
ifOk(void noFutures(Result<T> self, Ok<T> ok)) → Result<T>
Performs a side-effect with the contained value if this is an Ok.
isErr() → bool
Returns true if this Result is an Err.
isOk() → bool
Returns true if this Result is an Ok.
map<R extends Object>(R noFutures(T value)) → Result<R>
Transforms the contained value using the mapper function noFutures while preserving the Outcome's structure.
override
map10<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Object>>>>>>>>>>, provided by the MapOutcomeExt10 extension

map2<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Object>>, provided by the MapOutcomeExt2 extension

map3<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Object>>>, provided by the MapOutcomeExt3 extension

map4<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Object>>>>, provided by the MapOutcomeExt4 extension

map5<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Outcome<Object>>>>>, provided by the MapOutcomeExt5 extension

map6<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Object>>>>>>, provided by the MapOutcomeExt6 extension

map7<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Object>>>>>>>, provided by the MapOutcomeExt7 extension

map8<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Object>>>>>>>>, provided by the MapOutcomeExt8 extension

map9<R extends Object>(R mapper(T)) → TResolvableOption<Object>

Available on Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Outcome<Object>>>>>>>>>, provided by the MapOutcomeExt9 extension

mapErr(Err<T> noFutures(Err<T> err)) → Result<T>
Transforms the inner Err instance if this is an Err.
mapOk(Ok<T> noFutures(Ok<T> ok)) → Result<T>
Transforms the inner Ok instance if this is an Ok.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ok() → Option<Ok<T>>
Safely gets the Ok instance. Returns a Some on Ok, or a None on Err.
okOr(Result<T> other) → Result<T>
Returns this if it's Ok, otherwise returns the other Result.
orNull() → T?
Returns the contained Ok value or null.
raw({required FutureOr<Object> onErr(Err<Object> err), required FutureOr<Object> onNone()}) → FutureOr<Object>
The low-level primitive for reducing a Outcome chain. It recursively unwraps all Outcome layers to return the innermost raw value, forcing the caller to handle terminal states via callbacks.
inherited
rawAsync() → Async<Object>
Reduces any Outcome chain to a single Async.
inherited
rawSync() → Sync<Object>
Safely reduces any Outcome chain to a single Sync.
inherited
reduce<R extends Object>() → TResolvableOption<R>
Reduces any nested Outcome structure into a single TResolvableOption.
inherited
swap() → Option<Result<T>>

Available on Result<Option<T>>, provided by the SwapResultOptionExt extension

swap() → Sync<Result<T>>

Available on Result<Sync<T>>, provided by the SwapResultSyncExt extension

swap() → Some<Result<T>>

Available on Result<Some<T>>, provided by the SwapResultSomeExt extension

swap() → Resolvable<Result<T>>

Available on Result<Resolvable<T>>, provided by the SwapResultResolvableExt extension

swap() → Ok<Result<T>>

Available on Result<Ok<T>>, provided by the SwapResultOkExt extension

swap() → Result<T>

Available on Result<Err<T>>, provided by the SwapResultErrExt extension

swap() → Option<Result<T>>

Available on Result<None<T>>, provided by the SwapResultNoneExt extension

swap() → Async<Result<T>>

Available on Result<Async<T>>, provided by the SwapResultAsyncExt extension

toString() → String
A string representation of this object.
inherited
toUnit() → Outcome<Unit>

Available on Outcome<Object>, provided by the ToUnitOnObjectOutcome extension

toUnit() → Result<Unit>

Available on Result<Object>, provided by the ToUnitOnObjectResult extension

toVoid() → Outcome<void>

Available on Outcome<T>, provided by the ToVoidOnOutcomeExt extension

toVoid() → Result<void>

Available on Result<T>, provided by the ToVoidOnResultExt extension

transf<R extends Object>([R noFutures(T e)?]) → Result<R>
Transforms the Outcome's generic type from T to R.
override
unwrap() → T
Strongly discouraged: Unsafely returns the contained value.
override
unwrapOr(T fallback) → T
Returns the contained value, or the fallback if the Outcome is in an Err or None state.
override
wrapInAsync() → Async<M>

Available on M, provided by the WrapOnOutcomeExt extension

wrapInOk() → Ok<M>

Available on M, provided by the WrapOnOutcomeExt extension

wrapInResolvable() → Resolvable<M>

Available on M, provided by the WrapOnOutcomeExt extension

wrapInSome() → Some<M>

Available on M, provided by the WrapOnOutcomeExt extension

wrapInSync() → Sync<M>

Available on M, provided by the WrapOnOutcomeExt extension

wrapValueInAsync() → Outcome<Async<T>>

Available on M, provided by the WrapOnOutcomeExt extension

wrapValueInAsync() → Result<Async<T>>

Available on Result<T>, provided by the WrapOnResultExt extension

wrapValueInOk() → Outcome<Ok<T>>

Available on M, provided by the WrapOnOutcomeExt extension

wrapValueInOk() → Result<Ok<T>>

Available on Result<T>, provided by the WrapOnResultExt extension

wrapValueInResolvable() → Outcome<Resolvable<T>>

Available on M, provided by the WrapOnOutcomeExt extension

wrapValueInResolvable() → Result<Resolvable<T>>

Available on Result<T>, provided by the WrapOnResultExt extension

wrapValueInSome() → Outcome<Some<T>>

Available on M, provided by the WrapOnOutcomeExt extension

wrapValueInSome() → Result<Some<T>>

Available on Result<T>, provided by the WrapOnResultExt extension

wrapValueInSync() → Outcome<Sync<T>>

Available on M, provided by the WrapOnOutcomeExt extension

wrapValueInSync() → Result<Sync<T>>

Available on Result<T>, provided by the WrapOnResultExt extension

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

combine2<T1 extends Object, T2 extends Object>(Result<T1> r1, Result<T2> r2, [Err<(T1, T2)> onErr(Result<T1>, Result<T2>)?]) → Result<(T1, T2)>
Combines 2 Result outcomes into 1 containing a tuple of their values if all are Ok.
combine3<T1 extends Object, T2 extends Object, T3 extends Object>(Result<T1> r1, Result<T2> r2, Result<T3> r3, [Err<(T1, T2, T3)> onErr(Result<T1>, Result<T2>, Result<T3>)?]) → Result<(T1, T2, T3)>
Combines 3 Result outcomes into 1 containing a tuple of their values if all are Ok.