ReaderTaskEither<E, L, R>.fromNullableAsync constructor

ReaderTaskEither<E, L, R>.fromNullableAsync(
  1. R? r,
  2. Task<L> onNull
)

If r is null, then return the result of onNull in Left. Otherwise return Right(r).

Implementation

factory ReaderTaskEither.fromNullableAsync(R? r, Task<L> onNull) =>
    ReaderTaskEither(
      (_) async => r != null ? Either.of(r) : Either.left(await onNull.run()),
    );