foldNotNull<R> method
R?
foldNotNull<R>(
- R onSuccess(
- T value
- required R onFailure(
- ErrorMessage errorMessage
override
Similar to fold, but ensures that the value is not null before calling onSuccess
.
onSuccess
is the function that transforms the value if the result is a success and not null.
onNullOrFailure
is the function that transforms the error message or provides a default value if the result is null or a failure.
Implementation
@override
R? foldNotNull<R>(
R Function(T value) onSuccess, {
required R Function(ErrorMessage errorMessage) onFailure,
}) =>
onFailure(_error);