onSuccess method

Try<SuccessT, ResourceException> onSuccess(
  1. void action(
    1. SuccessT
    )
)
inherited

Performs the given action on the encapsulated value if this instance represents success. Returns the original Try unchanged.

Implementation

Try<Success, Failure> onSuccess(void Function(Success) action) {
  if (isSuccess) {
    action(getOrThrow());
  }
  return this;
}