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