Ok<T> class
final
- Inheritance
- Available extensions
Constructors
- Ok(T value)
-
Creates a success carrying
value.const
Properties
- error → ResultError?
-
The error, or
nullfor an Ok.no setteroverride - errorMessage → String
-
The error message, or
''for an Ok.no setterinherited - hashCode → int
-
The hash code for this object.
no setteroverride
- isFail → bool
-
True for Err.
no setterinherited
- isSuccess → bool
-
True for Ok.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
The success value. Non-null when
Tis non-nullable (the common case); for a nullableTit may be null.final - valueOrNull → T?
-
The success value, or
nullfor an Err. Prefer pattern matching or ResultCombinators.valueOr/ResultCombinators.getOrElse; a convenience for migration and display.no setteroverride
Methods
-
flatMap<
R> (Result< R> next(T value)) → Result<R> -
Available on Result<
Chain a success into another Result; pass an Err through unchanged.T> , provided by the ResultCombinators extension -
flatMapAsync<
R> (Future< Result< next(T value)) → Future<R> >Result< R> > -
Available on Result<
Async flatMap.T> , provided by the ResultCombinators extension -
fold<
R> (R onOk(T value), R onErr(ResultError error)) → R -
Available on Result<
Collapse into a single value by handling both branches.T> , provided by the ResultCombinators extension -
getOrElse(
T orElse(ResultError error)) → T -
Available on Result<
The success value, or the result ofT> , provided by the ResultCombinators extensionorElseon an Err. -
map<
R> (R transform(T value)) → Result< R> -
Available on Result<
Transform a success value; pass an Err through unchanged.T> , provided by the ResultCombinators extension -
mapError(
ResultError transform(ResultError error)) → Result< T> -
Available on Result<
Transform the error of an Err; a no-op on an Ok.T> , provided by the ResultCombinators extension -
match<
R> ({required R onOk(T value), required R onErr(ResultError error)}) → R -
Available on Result<
Named-parameter form of fold.T> , provided by the ResultCombinators extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recover(
T recovery(ResultError error)) → Result< T> -
Available on Result<
Turn an Err into an Ok viaT> , provided by the ResultCombinators extensionrecovery; a no-op on an Ok. -
toString(
) → String -
A string representation of this object.
inherited
-
valueOr(
T fallback) → T -
Available on Result<
The success value, orT> , provided by the ResultCombinators extensionfallbackon an Err.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override