operator | method

Result<T, E> operator |(
  1. Result<T, E> other
)

Combines two results using the or operator (|).

Shorthand for calling or. Returns this result if it's a success, otherwise returns other. Use this to provide fallback values when the first operation fails. The first success is returned.

Example:

final result = fetchFromCache() | fetchFromNetwork();

Implementation

Result<T, E> operator |(Result<T, E> other) => or(other);