fold<R> method
Allows handling the success and failure cases of a Result separately and returns a value of type R
.
onSuccess
is the function that transforms the value if the result is a success.
onFailure
is the function that transforms the error message if the result is a failure.
Implementation
@override
R fold<R>(
R Function(T value) onSuccess, {
required R Function(ErrorMessage errorMessage) onFailure,
}) =>
onFailure(_error);