tap method

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

Invokes action with the data on success, passing through the result unchanged. Useful for side effects like logging without transforming.

Implementation

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