fold<U> method

U fold<U>(
  1. U onSuccess(
    1. T
    ),
  2. U onFailure(
    1. E
    )
)

Folds this result into a single value using the appropriate function

Implementation

U fold<U>(U Function(T) onSuccess, U Function(E) onFailure) => switch (this) {
  Success(value: final value) => onSuccess(value),
  Failure(error: final error) => onFailure(error),
};