TaskEither<L, R>.fromPredicate constructor

TaskEither<L, R>.fromPredicate(
  1. R value,
  2. bool predicate(
    1. R a
    ),
  3. L onFalse(
    1. 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)));