TaskEither<L, R>.fromNullableAsync constructor
TaskEither<L, R>.fromNullableAsync (
- R? r,
- 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()));