AsyncRes<T extends Object, E extends Object> class final

Lazy asynchronous Res composition.

The wrapped operation is not executed when an AsyncRes is created or when map, next, mapError, or or are chained. Work starts only when run is called.

Annotations
  • @experimental

Constructors

AsyncRes(Future<Res<T, E>> _operation())
Creates a lazy asynchronous result from the provided operation.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<R extends Object>(R fn(T value)) AsyncRes<R, E>
Transforms the success value using fn.
mapError<R extends Object>(R fn(E error)) AsyncRes<T, R>
Transforms the error value using fn.
next<R extends Object>(AsyncRes<R, E> fn(T value)) AsyncRes<R, E>
Chains another AsyncRes operation when this result is Ok.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(AsyncRes<T, E> fn(E error)) AsyncRes<T, E>
Returns this result if it is Ok, or calls fn with the error.
run() Future<Res<T, E>>
Executes the wrapped operation.
toString() String
A string representation of this object.
inherited

Operators

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