onSuccess method

Try<Success, Failure> onSuccess(
  1. void action(
    1. Success
    )
)

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;
}