Task<A> class
final
Task represents an asynchronous computation that yields a value of type A and never fails.
If you want to represent an asynchronous computation that may fail, see TaskEither.
- Inheritance
- Mixed-in types
-
- Functor<
_TaskHKT, A> - Applicative<
_TaskHKT, A> - Monad<
_TaskHKT, A>
- Functor<
- Available extensions
Constructors
-
Task(Future<
A> _run()) -
Build a Task from a function returning a Future.
const
-
Task.Do(DoFunctionTask<
A> f) -
Initialize a Do Notation chain.
factory
-
Task.flatten(Task<
Task< task)A> > -
Flat a Task contained inside another Task to be a single Task.
factory
- Task.of(A a)
-
Build a Task that returns
a.factory
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
-
andThen<
B> (covariant Task< B> then()) → Task<B> -
Run this Task and right after the Task returned from
then.override -
ap<
B> (covariant Task< B Function(A a)> a) → Task<B> -
Apply the function contained inside
ato change the value of typeAto a value of typeB.override -
call<
B> (covariant Task< B> chain) → Task<B> -
Chain multiple Task functions.
override
-
chainFirst<
B> (covariant Task< B> chain(A a)) → Task<A> -
override
-
delay(
Duration duration) → Task< A> - Creates a task that will complete after a time delay specified by a Duration.
-
flatMap<
B> (covariant Task< B> f(A a)) → Task<B> -
Used to chain multiple functions that return a Task.
override
-
map<
B> (B f(A a)) → Task< B> -
Change the returning value of the Task from type
Ato typeBusingf.override -
map2<
C, D> (covariant Task< C> mc, D f(A a, C c)) → Task<D> -
Change type of this Task based on its value of type
Aand the value of typeCof another Task.override -
map3<
C, D, E> (covariant Task< C> mc, covariant Task<D> md, E f(A a, C c, D d)) → Task<E> -
Change type of this Task based on its value of type
A, the value of typeCof a second Task, and the value of typeDof a third Task.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pure<
B> (B a) → Task< B> -
Return a Task returning the value
b.override -
run(
) → Future< A> - Run the task and return a Future.
-
toString(
) → String -
A string representation of this object.
inherited
-
toTaskEither<
L> () → TaskEither< L, A> - Convert this Task to TaskEither.
-
toTaskEitherFlat(
) → TaskEither< L, R> -
Available on Task<
Either< , provided by the CompositionEitherExtension extensionL, R> > -
toTaskOption(
) → TaskOption< A> - Convert this Task to TaskOption.
-
toTaskOptionFlat(
) → TaskOption< T> -
Available on Task<
Option< , provided by the CompositionOptionExtension extensionT> >
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
sequenceList<
A> (List< Task< list) → Task<A> >List< A> > -
Convert a
List<Task<A>>to a singleTask<List<A>>. -
sequenceListSeq<
A> (List< Task< list) → Task<A> >List< A> > -
Convert a
List<Task<A>>to a singleTask<List<A>>. -
traverseList<
A, B> (List< A> list, Task<B> f(A a)) → Task<List< B> > -
Map each element in the list to a Task using the function
f, and collect the result in anTask<List<B>>. -
traverseListSeq<
A, B> (List< A> list, Task<B> f(A a)) → Task<List< B> > -
Map each element in the list to a Task using the function
f, and collect the result in anTask<List<B>>. -
traverseListWithIndex<
A, B> (List< A> list, Task<B> f(A a, int i)) → Task<List< B> > -
Map each element in the list to a Task using the function
f, and collect the result in anTask<List<B>>. -
traverseListWithIndexSeq<
A, B> (List< A> list, Task<B> f(A a, int i)) → Task<List< B> > -
Map each element in the list to a Task using the function
f, and collect the result in anTask<List<B>>.