or method
Returns this result if it's a success, otherwise the already-evaluated
other.
Use this to provide a fallback result when the first result fails.
The first successful result is returned; if both fail, the second error
is returned. Because Dart evaluates operator operands before calling the
operator, this does not prevent other from being created. Use orLazy
for lazy fallbacks, or orElse for fallbacks based on the error.
Example:
Result<int, String> a = Err('failed');
Result<int, String> b = Ok(10);
final result = a | b; // Returns b (Ok(10))
final result = cachedResult | freshResult;
Implementation
Result<T, E> or(Result<T, E> other) {
if (this is Ok<T, E>) return this;
return other;
}