fold<R> method
Reduces this result to a single value by handling both outcomes explicitly.
Both callbacks are required, ensuring exhaustive handling. This is the recommended way to consume results when you need to act on failures.
Implementation
R fold<R>({
required R Function(T value) onSuccess,
required R Function(ConversionException error) onFailure,
}) {
if (isSuccess) return onSuccess(_value as T);
return onFailure(_error!);
}