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

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<A>> task)
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 a to change the value of type A to a value of type B.
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 A to type B using f.
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 A and the value of type C of 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 type C of a second Task, and the value of type D of 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.
toTaskOption() TaskOption<A>
Convert this Task to TaskOption.

Operators

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

Static Methods

sequenceList<A>(List<Task<A>> list) Task<List<A>>
Convert a List<Task<A>> to a single Task<List<A>>.
sequenceListSeq<A>(List<Task<A>> list) Task<List<A>>
Convert a List<Task<A>> to a single Task<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 an Task<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 an Task<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 an Task<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 an Task<List<B>>.