TaskEither<L, R> class

TaskEither<L, R> represents an asynchronous computation that either yields a value of type R or fails yielding an error of type L.

If you want to represent an asynchronous computation that never fails, see Task.

Inheritance
Mixed-in types

Constructors

TaskEither(Future<Either<L, R>> _run())
Build a TaskEither from a function returning a Future<Either<L, R>>.
const
TaskEither.Do(DoFunctionTaskEither<L, R> f)
Initialize a Do Notation chain.
factory
TaskEither.flatten(TaskEither<L, TaskEither<L, R>> taskEither)
Flat a TaskEither contained inside another TaskEither to be a single TaskEither.
factory
TaskEither.fromEither(Either<L, R> either)
Build a TaskEither that returns either.
factory
TaskEither.fromNullable(R? r, L onNull())
If r is null, then return the result of onNull in Left. Otherwise return Right(r).
factory
TaskEither.fromNullableAsync(R? r, Task<L> onNull)
If r is null, then return the result of onNull in Left. Otherwise return Right(r).
factory
TaskEither.fromOption(Option<R> option, L onNone())
Build a TaskEither from option.
factory
TaskEither.fromPredicate(R value, bool predicate(R a), L onFalse(R a))
When calling predicate with value returns true, then running TaskEither returns Right(value). Otherwise return onFalse.
factory
TaskEither.fromTask(Task<R> task)
Build a TaskEither from the result of running task.
factory
TaskEither.left(L left)
Build a TaskEither that returns a Left(left).
factory
TaskEither.leftTask(Task<L> task)
Build a TaskEither that returns a Left containing the result of running task.
factory
TaskEither.of(R r)
Build a TaskEither that returns a Right(r).
factory
TaskEither.right(R right)
Build a TaskEither that returns a Right(right).
factory
TaskEither.rightTask(Task<R> task)
Build a TaskEither that returns a Right containing the result of running task.
factory
TaskEither.tryCatch(Future<R> run(), L onError(Object error, StackTrace stackTrace))
Execute an async function (Future) and convert the result to Either:
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

alt(covariant TaskEither<L, R> orElse()) TaskEither<L, R>
When this TaskEither returns Right, then return the current TaskEither. Otherwise return the result of orElse.
override
andThen<C>(covariant TaskEither<L, C> then()) TaskEither<L, C>
If running this TaskEither returns Right, then return the result of calling then. Otherwise return Left.
override
ap<C>(covariant TaskEither<L, C Function(R r)> a) TaskEither<L, C>
Apply the function contained inside a to change the value on the Right from type R to a value of type C.
override
bimap<C, D>(C mLeft(L l), D mRight(R r)) TaskEither<C, D>
Define two functions to change both the Left and Right value of the TaskEither.
bindEither<C>(Either<L, C> either) TaskEither<L, C>
Chain an Either to TaskEither by converting it from sync to async.
call<C>(covariant TaskEither<L, C> chain) TaskEither<L, C>
Chain multiple functions having the same left type L.
override
chainEither<C>(Either<L, C> f(R r)) TaskEither<L, C>
Chain a function that takes the current value R inside this TaskEither and returns Either.
chainFirst<C>(covariant TaskEither<L, C> chain(R b)) TaskEither<L, R>
Chain a request that returns another TaskEither, execute it, ignore the result, and return the same value as the current TaskEither.
override
delay(Duration duration) TaskEither<L, R>
Creates a TaskEither that will complete after a time delay specified by a Duration.
filterOrElse(bool f(R r), L onFalse(R r)) TaskEither<L, R>
If f applied on this TaskEither as Right returns true, then return this TaskEither. If it returns false, return the result of onFalse in a Left.
flatMap<C>(covariant TaskEither<L, C> f(R r)) TaskEither<L, C>
Used to chain multiple functions that return a TaskEither.
override
getOrElse(R orElse(L l)) Task<R>
Convert this TaskEither to a Task.
map<C>(C f(R r)) TaskEither<L, C>
If running this TaskEither returns Right, then change its value from type R to type C using function f.
override
map2<C, D>(covariant TaskEither<L, C> m1, D f(R b, C c)) TaskEither<L, D>
Change the return type of this TaskEither based on its value of type R and the value of type C of another TaskEither.
override
map3<C, D, E>(covariant TaskEither<L, C> m1, covariant TaskEither<L, D> m2, E f(R b, C c, D d)) TaskEither<L, E>
Change the return type of this TaskEither based on its value of type R, the value of type C of a second TaskEither, and the value of type D of a third TaskEither.
override
mapLeft<C>(C f(L l)) TaskEither<C, R>
Change the value in the Left of TaskEither.
match<A>(A onLeft(L l), A onRight(R r)) Task<A>
Pattern matching to convert a TaskEither to a Task.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orElse<TL>(TaskEither<TL, R> orElse(L l)) TaskEither<TL, R>
When this TaskEither returns a Left then return the result of orElse. Otherwise return this TaskEither.
pure<C>(C a) TaskEither<L, C>
Returns a TaskEither that returns a Right(a).
override
run() Future<Either<L, R>>
Run the task and return a Future<Either<L, R>>.
swap() TaskEither<R, L>
Change this TaskEither from TaskEither<L, R> to TaskEither<R, L>.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

sequenceList<E, A>(List<TaskEither<E, A>> list) TaskEither<E, List<A>>
Convert a List<TaskEither<E, A>> to a single TaskEither<E, List<A>>.
sequenceListSeq<E, A>(List<TaskEither<E, A>> list) TaskEither<E, List<A>>
Convert a List<TaskEither<E, A>> to a single TaskEither<E, List<A>>.
traverseList<E, A, B>(List<A> list, TaskEither<E, B> f(A a)) TaskEither<E, List<B>>
Map each element in the list to a TaskEither using the function f, and collect the result in an TaskEither<E, List<B>>.
traverseListSeq<E, A, B>(List<A> list, TaskEither<E, B> f(A a)) TaskEither<E, List<B>>
Map each element in the list to a TaskEither using the function f, and collect the result in an TaskEither<E, List<B>>.
traverseListWithIndex<E, A, B>(List<A> list, TaskEither<E, B> f(A a, int i)) TaskEither<E, List<B>>
Map each element in the list to a TaskEither using the function f, and collect the result in an TaskEither<E, List<B>>.
traverseListWithIndexSeq<E, A, B>(List<A> list, TaskEither<E, B> f(A a, int i)) TaskEither<E, List<B>>
Map each element in the list to a TaskEither using the function f, and collect the result in an TaskEither<E, List<B>>.
tryCatchK<L, R, T>(Future<R> run(T a), L onError(Object error, StackTrace stackTrace)) TaskEither<L, R> Function(T a)
Execute an async function (Future) and convert the result to Either: