flatMapNullableOrFail<B> method
A variant of flatMap that determines the result of the ZIO by evaluating the resulting nullable value.
If the value is null
, the resulting ZIO will fail with onNull
.
Implementation
ZIO<R, E, B> flatMapNullableOrFail<B>(
B? Function(A _) f,
E Function(A _) onNull,
) =>
flatMapEither((a) => Either.fromNullable(f(a), () => onNull(a)));