SuccessResult<T> class

A concrete success variant container extending the base Result contract state.

Inheritance
Available extensions

Constructors

SuccessResult(T value)
Allocates a private success representation, internally constructing a wrapper Success.

Properties

failureOrNull → Failure?
Yields the contained structured Failure representation if the operation failed; otherwise, returns null.
no setterinherited
hashCode int
Computes a precise hash configuration based on the underlying variant type hash calculation.
no setterinherited
isFailure bool
Evaluates true if this runtime instance encapsulates a caught data failure state.
no setterinherited
isSuccess bool
Evaluates true if this runtime instance encapsulates an underlying successful operation outcome.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
success → Success<T>
Holds the reference object containing the successfully returned data payload.
final
successOrNull → Success<T>?
Exposes the comprehensive immutable Success wrapper envelope if applicable; otherwise, yields null.
no setterinherited
valueOrNull → T?
Unwraps and yields the domain value payload directly if the execution succeeded; otherwise, returns null.
no setterinherited

Methods

flatMap<R>(Result<R> transform(T value)) Result<R>
Chains sequential asynchronous or synchronous monadic operations where the transform callback yields another encapsulated Result envelope.
inherited
fold<R>({required R onSuccess(T value), required R onFailure(Failure failure)}) → R
Collapses the dual state of this result wrapper into a uniform type R.
inherited
getOrElse(T defaultValue) → T
Returns the embedded success value payload directly if present, otherwise fallbacks onto the statically provided defaultValue.
inherited
getOrElseAsync(FutureOr<T> onFallback(Failure failure)) Future<T>

Available on Result<T>, provided by the ResultExtensions extension

Extracts the encapsulated success value directly from Success, or invokes an asynchronous fallback strategy when a Failure is encountered.
getOrElseFn(T orElse(Failure failure)) → T
Returns the embedded success value payload directly if present, otherwise invokes the functional lazy callback orElse passing down the underlying structural failure context.
inherited
getOrThrow() → T
Forces extraction of the underlying value or transforms a domain failure into a terminal runtime state exception.
inherited
map<R>(R transform(T value)) Result<R>
Transforms the inner success value type using the provided transform mapper callback function.
inherited
mapFailure(Failure transform(Failure failure)) Result<T>
Transforms the underlying domain failure signature using the provided error transform closure.
inherited
mapFailure(Failure transform(Failure failure)) Result<S>

Available on Result<S>, provided by the ResultFailureMappingExtension extension

Transforms the inner Failure details if the operational outcome is a failure state.
match<R>({required R onSuccess(Success<T> success), required R onFailure(Failure failure)}) → R
Performs state matching similarly to fold, but explicitly passes the underlying granular Success context object rather than just its unwrapped value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recover(Result<T> onFailure(Failure failure)) Result<T>

Available on Result<T>, provided by the ResultExtensions extension

Recovers from an operational failure by mapping the non-generic Failure instance into a new alternative Result.
throwIfNeeded() → T

Available on Result<T>, provided by the ResultTransformationX extension

Forcefully unwraps the successful value or throws a managed ResultException.
toNullable() → T?

Available on Result<T>, provided by the ResultTransformationX extension

Unwraps the Result and returns the successful value if present, otherwise returns null without throwing an exception.
toString() String
Maps the string display format dynamically reflecting the current active subtype variant.
inherited
when({required Widget onSuccess(T value), required Widget onFailure(Failure failure)}) Widget

Available on Result<T>, provided by the ResultFlutterX extension

Transforms the Result state directly into a Flutter widget.

Operators

operator ==(Object other) bool
Implements deep state structural equality validation across distinct Result wrappers.
inherited