thenMapEither<C> method
map
the Either
in the Future context.
When this Future completes with a Right value,
calling f
callback with Right.value.
And returns a new Future which is completed with a Right value
which containing the result of the call to f
.
If this Future completes with a Left value, returns a Future that completes with a Left which containing original Left.value.
This function does not handle any errors. See Future.then.
Implementation
Future<Either<L, C>> thenMapEither<C>(FutureOr<C> Function(R value) f) =>
then(
(either) => either.fold(
ifLeft: (v) => v.left<C>(),
ifRight: (v) => Future.sync(() => f(v)).then((v) => v.right<L>()),
),
);