onFailure method

Result<T, E> onFailure(
  1. void action(
    1. E
    )
)

Executes the given function with the error if this is a failure

Implementation

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