Ok<T, E extends BaseException> class final

Successful result wrapper.

Inheritance
Available extensions

Constructors

Ok(T value)
Creates a successful result containing value.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isErr bool
Returns true when this result contains an error.
no setterinherited
isOk bool
Returns true when this result contains a value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
The contained success value.
final

Methods

andThen<U>(Result<U, E> next(T value)) Result<U, E>
Chains another computation only when this result is successful.
inherited
andThenAsync<U>(Future<Result<U, E>> next(T value)) Future<Result<U, E>>
Async variant of andThen for future-returning pipelines.
inherited
map<U>(U f(T value)) Result<U, E>
Maps the inner value when successful, preserving errors.
inherited
mapAsync<U>(Future<U> f(T value)) Future<Result<U, E>>

Available on Result<T, E>, provided by the ResultX extension

Maps the success value using an async transformer, preserving errors.
mapErr<F extends BaseException>(F f(E error)) Result<T, F>
Maps the error type when present, preserving successes.
inherited
match<R>({required R ok(T value), required R err(E error)}) → R
Pattern matches on the result, invoking ok or err accordingly.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
unwrap() → T
Unwraps the result, throwing if it contains an error.
inherited
unwrapOr(T fallback) → T
Returns the inner value or fallback when this is an error.
inherited
unwrapOrElse(T f(E error)) → T
Returns the inner value or computes one via f.
inherited

Operators

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