onFailure method

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

Run a side-effect on failure, then return this unchanged.

Implementation

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