TaskEither<L, R>.fromNullableAsync constructor

TaskEither<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 TaskEither.fromNullableAsync(R? r, Task<L> onNull) => TaskEither(
    () async => r != null ? Either.of(r) : Either.left(await onNull.run()));