Either<L, R>.fromNullable constructor
- R? r,
- L onNull(
If r
is null
, then return the result of onNull
in Left.
Otherwise return Right(r)
.
Implementation
factory Either.fromNullable(R? r, L Function() onNull) =>
r != null ? Either.of(r) : Either.left(onNull());