flatMap<R> method
Chains sequential asynchronous or synchronous monadic operations where the transform callback
yields another encapsulated Result envelope.
Prevents flat nested structures like Result<Result<R>> by keeping execution pipelines linear.
Implementation
Result<R> flatMap<R>(Result<R> Function(T value) transform) => switch (this) {
_SuccessResult<T>(success: final success) => transform(success.value),
_FailureResult<T>(failure: final failure) => Result<R>.failure(failure),
};