result library

Typed success and failure values for operations that can fail.

Result makes failure part of the return type. Handle both Ok and Err with a switch, or compose operations with methods such as map and andThen. For asynchronous operations, see FutureResult.

Classes

Err<T extends Object?, E extends Object>
Represents a failed result containing an error and its stack trace.
Ok<T extends Object?, E extends Object>
Represents a successful result containing a value.
Result<T extends Object?, E extends Object>
A type-safe way to handle operations that may fail.

Extensions

FlattenResultExtension on Result<Result<T, E>, E>
Extension methods for flattening nested result types.
InspectResultExtension on Result<T, E>
Extension methods for inspecting result values without transforming them.

Typedefs

CatchAllResult<T extends Object?> = Result<T, Object>
A result type that captures either a successful value or any error.
FutureResult<T extends Object?, E extends Object> = Future<Result<T, E>>
A future result that will eventually resolve to either a value or an error.