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
Failurerepresentation if the operation failed; otherwise, returnsnull.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
Successwrapper envelope if applicable; otherwise, yieldsnull.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
transformcallback 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<
Extracts the encapsulated success value directly fromT> , provided by the ResultExtensions extensionSuccess, or invokes an asynchronous fallback strategy when aFailureis encountered. -
getOrElseFn(
T orElse(Failure failure)) → T -
Returns the embedded success value payload directly if present, otherwise invokes the functional
lazy callback
orElsepassing 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
transformmapper callback function.inherited -
mapFailure(
Failure transform(Failure failure)) → Result< T> -
Transforms the underlying domain failure signature using the provided error
transformclosure.inherited -
mapFailure(
Failure transform(Failure failure)) → Result< S> -
Available on Result<
Transforms the innerS> , provided by the ResultFailureMappingExtension extensionFailuredetails 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
Successcontext 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<
Recovers from an operational failure by mapping the non-genericT> , provided by the ResultExtensions extensionFailureinstance into a new alternative Result. -
throwIfNeeded(
) → T -
Available on Result<
Forcefully unwraps the successful value or throws a managed ResultException.T> , provided by the ResultTransformationX extension -
toNullable(
) → T? -
Available on Result<
Unwraps the Result and returns the successful value if present, otherwise returnsT> , provided by the ResultTransformationX extensionnullwithout 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<
Transforms the Result state directly into a Flutter widget.T> , provided by the ResultFlutterX extension
Operators
-
operator ==(
Object other) → bool -
Implements deep state structural equality validation across distinct Result wrappers.
inherited