onSuccess method

Result<T> onSuccess(
  1. void action(
    1. T data
    )
)

Invokes action with the data if this is a Success. Returns this for chaining.

Implementation

Result<T> onSuccess(void Function(T data) action) {
  if (this case Success<T>(:final data)) action(data);
  return this;
}