IOEither<L, R> class final

IOEither<L, R> represents a non-deterministic synchronous computation that can cause side effects, yields a value of type R or can fail by returning a value of type L.

If you want to represent a synchronous computation that may never fail, see IO.

Inheritance
Mixed in types

Constructors

IOEither(Either<L, R> _run())
Build an instance of IOEither from Either<L, R> Function().
const
IOEither.Do(DoFunctionIOEither<L, R> f)
Initialize a Do Notation chain.
factory
IOEither.flatten(IOEither<L, IOEither<L, R>> ioEither)
Flat a IOEither contained inside another IOEither to be a single IOEither.
factory
IOEither.fromEither(Either<L, R> either)
Build a IOEither that returns either.
factory
IOEither.fromIO(IO<R> io)
Build a IOEither from the result of running io.
factory
IOEither.fromNullable(R? r, L onNull())
If r is null, then return the result of onNull in Left. Otherwise return Right(r).
factory
IOEither.fromOption(Option<R> option, L onNone())
Build a IOEither from option.
factory
IOEither.fromPredicate(R value, bool predicate(R a), L onFalse(R a))
When calling predicate with value returns true, then running IOEither returns Right(value). Otherwise return onFalse.
factory
IOEither.left(L left)
Build a IOEither that returns a Left(left).
factory
IOEither.leftIO(IO<L> io)
Build a IOEither that returns a Left containing the result of running io.
factory
IOEither.of(R r)
Build a IOEither that returns a Right(r).
factory
IOEither.right(R right)
Build a IOEither that returns a Right(right).
factory
IOEither.rightIO(IO<R> io)
Build a IOEither that returns a Right containing the result of running io.
factory
IOEither.tryCatch(R run(), L onError(Object error, StackTrace stackTrace))
Converts a Function that may throw to a Function that never throws but returns a Either instead.
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 IOEither<L, R> orElse()) IOEither<L, R>
When this IOEither returns Right, then return the current IOEither. Otherwise return the result of orElse.
override
andThen<C>(covariant IOEither<L, C> then()) IOEither<L, C>
If running this IOEither returns Right, then return the result of calling then. Otherwise return Left.
override
ap<C>(covariant IOEither<L, C Function(R r)> a) IOEither<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 a), D mRight(R b)) IOEither<C, D>
Define two functions to change both the Left and Right value of the IOEither.
call<C>(covariant IOEither<L, C> chain) IOEither<L, C>
Chain multiple functions having the same left type L.
override
chainFirst<C>(covariant IOEither<L, C> chain(R b)) IOEither<L, R>
Chain a request that returns another IOEither, execute it, ignore the result, and return the same value as the current IOEither.
override
filterOrElse(bool f(R r), L onFalse(R r)) IOEither<L, R>
If f applied on this IOEither as Right returns true, then return this IOEither. If it returns false, return the result of onFalse in a Left.
flatMap<C>(covariant IOEither<L, C> f(R r)) IOEither<L, C>
Used to chain multiple functions that return a IOEither.
override
flatMapTask<C>(TaskEither<L, C> f(R r)) TaskEither<L, C>
Chain a TaskEither with an IOEither.
getOrElse(R orElse(L l)) IO<R>
Convert this IOEither to a IO.
map<C>(C f(R r)) IOEither<L, C>
If running this IOEither returns Right, then change its value from type R to type C using function f.
override
map2<C, D>(covariant IOEither<L, C> m1, D f(R b, C c)) IOEither<L, D>
Change the return type of this IOEither based on its value of type R and the value of type C of another IOEither.
override
map3<C, D, E>(covariant IOEither<L, C> m1, covariant IOEither<L, D> m2, E f(R b, C c, D d)) IOEither<L, E>
Change the return type of this IOEither based on its value of type R, the value of type C of a second IOEither, and the value of type D of a third IOEither.
override
mapLeft<C>(C f(L l)) IOEither<C, R>
Change the value in the Left of IOEither.
match<A>(A onLeft(L l), A onRight(R r)) IO<A>
Pattern matching to convert a IOEither to a IO.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orElse<TL>(IOEither<TL, R> orElse(L l)) IOEither<TL, R>
When this IOEither returns a Left then return the result of orElse. Otherwise return this IOEither.
pure<C>(C a) IOEither<L, C>
Returns a IOEither that returns a Right(a).
override
run() Either<L, R>
Run the IO and return a Either<L, R>.
swap() IOEither<R, L>
Change this IOEither from IOEither<L, R> to IOEither<R, L>.
toString() String
A string representation of this object.
inherited
toTaskEither() TaskEither<L, R>
Convert this IOEither to TaskEither.

Operators

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

Static Methods

sequenceList<E, A>(List<IOEither<E, A>> list) IOEither<E, List<A>>
Convert a List<IOEither<E, A>> to a single IOEither<E, List<A>>.
traverseList<E, A, B>(List<A> list, IOEither<E, B> f(A a)) IOEither<E, List<B>>
Map each element in the list to a IOEither using the function f, and collect the result in an IOEither<E, List<B>>.
traverseListWithIndex<E, A, B>(List<A> list, IOEither<E, B> f(A a, int i)) IOEither<E, List<B>>
Map each element in the list to a IOEither using the function f, and collect the result in an IOEither<E, List<B>>.