Result<T, E> class sealed

Result of a fallible operation. Expected failures are returned as Err instead of thrown — FileSystem operations must never throw.

Ported from pi's Result<TValue, TError> union.

Implementers

Properties

errorOrNull → E?
The failure error, or null when this is an Ok.
no setter
hashCode int
The hash code for this object.
no setterinherited
isErr bool
Whether this is an Err result.
no setter
isOk bool
Whether this is an Ok result.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
The success value, or null when this is an Err.
no setter

Methods

getOrThrow() → T
Returns the success value or throws the failure error. Intended for tests and explicit adapter boundaries (mirrors pi's getOrThrow).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited