TaskEither<L, R>.fromPredicate constructor
TaskEither<L, R>.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.
Implementation
factory TaskEither.fromPredicate(
R value, bool Function(R a) predicate, L Function(R a) onFalse) =>
TaskEither(
() async => predicate(value) ? Right(value) : Left(onFalse(value)));