Success<S, F> class
final
The success variant of Result.
Constructors
- Success(S value)
-
Creates a successful result.
const
Properties
- failureOrNull → F?
-
Returns the failure value, or
nullif this is a success.no setterinherited - hashCode → int
-
The hash code for this object.
no setteroverride
- isFailure → bool
-
Returns
trueif this is a Failure.no setterinherited - isSuccess → bool
-
Returns
trueif 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
nullif this is a failure.no setterinherited - valueOrThrow → S
-
Returns the success value or throws a StateError.
no setterinherited
Methods
-
asyncMap<
T> (Future< Result< transform(S value)) → Future<T, F> >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
otherif 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
successorfailuredepending on the variant.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override