fold<R> method
Pattern-matches on this result, returning a value from the appropriate callback.
Implementation
R fold<R>({
required R Function(T data) onSuccess,
required R Function(SecurityException error) onFailure,
}) {
return switch (this) {
Success<T>(:final data) => onSuccess(data),
Failure<T>(:final error) => onFailure(error),
};
}