taskeither library
Classes
-
TaskEither<A, B>
-
TaskEither
is a representation of asynchronous computations that can fail.
It's a way of combining the concepts of Future
and Either
.
Properties
-
chain
→ TaskEither<A, B> Function(TaskEither<A, C>) Function<A, C, B>(TaskEither<A, B> f(C))
-
Alias for flatMap, allowing for chaining asynchronous operations.
final
-
chainFirst
→ TapFunctionEither<A, B> Function<A, B>(void f(B))
-
Alias for tap.
final
-
fold
→ Future<C> Function(TaskEither<A, B>) Function<A, B, C>(Future<C> onLeft(A), Future<C> onRight(B))
-
Alias for match.
final
Functions
-
ap<A, C, B>(TaskEither<A, B Function(C)> fnTaskEither)
→ TaskEither<A, B> Function(TaskEither<A, C>)
-
Applies the provided function wrapped in a TaskEither instance to a TaskEither instance.
-
flatMap<A, C, B>(TaskEither<A, B> f(C))
→ TaskEither<A, B> Function(TaskEither<A, C>)
-
Transforms the success value of a TaskEither instance into another TaskEither using the provided function
f
.
-
fromOption<A, B>(A leftValue())
→ TaskEither<A, B> Function(Option<B> option)
-
Converts an o.Option<B> into a TaskEither<A, B> based on whether the option contains a value or not.
-
fromPredicate<A, B>(Predicate<B> predicate, A leftValue())
→ TaskEither<A, B> Function(B value)
-
Creates a TaskEither based on a predicate function.
-
getOrElse<A, B>(B defaultValue(A))
→ Future<B> Function(TaskEither<A, B>)
-
Retrieves the value from a TaskEither<A, B>, or produces a default value if it's a e.Left.
-
left<A, B>(A value)
→ TaskEither<A, B>
-
Create a
Left
value wrapped in a TaskEither
.
-
map<A, C, B>(B f(C))
→ TaskEither<A, B> Function(TaskEither<A, C>)
-
Transforms the success value of a TaskEither instance using the provided function
f
.
-
match<A, B, C>(Future<C> onLeft(A), Future<C> onRight(B))
→ Future<C> Function(TaskEither<A, B>)
-
Matches a TaskEither<A, B> to execute a function based on its
Left
or Right
value asynchronously.
Using Dart's pattern matching, the match function provides an expressive and concise way to handle
TaskEither
values without manual type checks and returns a Future<C> representing the computed value.
-
matchW<A, B, C, D>(Future<D> onLeft(A), Future<D> onRight(B))
→ Future<D> Function(TaskEither<A, B>)
-
Applies the provided functions
onLeft
and onRight
to handle the
contents of a TaskEither instance. The returned function takes a TaskEither
as input, awaits its computation, and depending on whether it's a Left
or Right
,
invokes the appropriate function.
-
of<A, B>(B value)
→ TaskEither<A, B>
-
Shorthand for creating a
Right
value wrapped in a TaskEither
.
-
right<A, B>(B value)
→ TaskEither<A, B>
-
Create a
Right
value wrapped in a TaskEither
.
-
sequenceList<A, B>(ImmutableList<TaskEither<A, B>> list)
→ Future<Either<A, ImmutableList<B>>>
-
Sequences a list of
TaskEither
into a single TaskEither
that produces a list of results.
-
tap<A, B>(void f(B))
→ TapFunctionEither<A, B>
-
Applies a side effect on a successful result of the
TaskEither
without modifying it.
-
traverseList<E, A, B>(TaskEither<E, B> f(A), ImmutableList<A> list)
→ Future<Either<E, ImmutableList<B>>>
-
Traverses a list of items, applying a function to each item, and then
sequences the resulting list of
TaskEither
into a single TaskEither
that
produces a list of results.