Success<S, F> class final

The success variant of Result.

Inheritance

Constructors

Success(S value)
Creates a successful result.
const

Properties

failureOrNull → F?
Returns the failure value, or null if this is a success.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
isFailure bool
Returns true if this is a Failure.
no setterinherited
isSuccess bool
Returns true if this is a Success.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → S
The contained success value.
final
valueOrNull → S?
Returns the success value, or null if this is a failure.
no setterinherited
valueOrThrow → S
Returns the success value or throws a StateError.
no setterinherited

Methods

asyncMap<T>(Future<Result<T, F>> transform(S value)) Future<Result<T, F>>
Flat-maps the success value, used for chaining operations.
inherited
map<T>(T transform(S value)) Result<T, F>
Maps the success value using transform, leaving failures unchanged.
inherited
mapFailure<T>(T transform(F failure)) Result<S, T>
Maps the failure value using transform, leaving successes unchanged.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(Result<S, F> other) Result<S, F>
Returns other if this is a failure, otherwise returns this.
inherited
toString() String
A string representation of this object.
inherited
when<T>({required T success(S value), required T failure(F failure)}) → T
Executes success or failure depending on the variant.
inherited

Operators

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