fold<R> method

R fold<R>(
  1. R onSuccess(
    1. T data
    ),
  2. R onFailure(
    1. AuthException error
    )
)

Implementation

R fold<R>(R Function(T data) onSuccess, R Function(AuthException error) onFailure) {
  if (isSuccess) {
    return onSuccess(data as T);
  }
  return onFailure(error!);
}