onFailure method

Result<T> onFailure(
  1. void action(
    1. ApiError error
    )
)

Calls action with the error (if any) and returns this.

Implementation

Result<T> onFailure(void Function(ApiError error) action) {
  if (this case Failure<T>(:final error)) action(error);
  return this;
}