Ok<T, E> class
final
Successful operation result.
const result = Ok<int, String>(42);
- Inheritance
- Available extensions
Constructors
- Ok(T value)
-
Creates one successful result.
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isErr → bool
-
Whether this result is Err.
no setterinherited
- isOk → bool
-
Whether this result is Ok.
no setteroverride
- orReject → T
-
Available on Result<
The extracted value, or a thrown Rejection.T, Rejection> , provided by the RejectOnFailure extensionno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
Successful value.
final
Methods
-
andThen<
R> (Result< R, E> next(T value)) → Result<R, E> -
Chains another result-producing operation when this result is successful.
override
-
map<
R> (R mapper(T value)) → Result< R, E> -
Maps a successful value and leaves errors unchanged.
override
-
mapErr<
F> (F mapper(E error)) → Result< T, F> -
Maps an error value and leaves successful values unchanged.
override
-
match<
R> ({required R ok(T value), required R err(E error)}) → R -
Pattern matches this result.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orElse<
F> (Result< T, F> next(E error)) → Result<T, F> -
Chains another result-producing operation when this result failed.
override
-
toString(
) → String -
A string representation of this object.
override
-
unwrapOr(
T fallback) → T -
Returns the successful value, or
fallbackwhen this result failed.override -
unwrapOrElse(
T fallback(E error)) → T -
Returns the successful value, or computes one from the error.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override