onSuccess method

Try<SuccessT, UserException> 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;
}