BlocxUseCaseFailure<T> class
A failed BlocxUseCaseResult carrying the error and optional stackTrace.
Constructed automatically by BlocxBaseUseCase.failureResult when an unhandled exception escapes BlocxBaseUseCase.perform. Override BlocxBaseUseCase.failureResult to wrap error in a domain-specific type before it reaches the bloc.
- Inheritance
-
- Object
- BlocxUseCaseResult<
T> - BlocxUseCaseFailure
Constructors
- BlocxUseCaseFailure(dynamic error, [StackTrace? stackTrace])
-
Creates a failure result.
const
Properties
- data → Null
-
The output value, or
nullif this is a BlocxUseCaseFailure.no setteroverride - dataOrThrow → T
-
Unwraps data, throwing error if this is a failure.
no setterinherited
- error → dynamic
-
The error object that caused the failure.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFailure → bool
-
Whether this result represents a failed execution.
no setterinherited
- isSuccess → bool
-
Whether this result represents a successful execution.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace captured at the failure site.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
R> ({required R onSuccess(T data), required R onFailure(dynamic error, StackTrace? stackTrace)}) → R -
Handles both outcomes without null-guarding data or error manually.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited