SuccessOperation<T> class
final
Represents a successfully completed operation with associated data.
The data getter returns exactly T: non-null when T is non-nullable,
nullable when T is nullable. The constructor enforces this at the call
site: SuccessOperation<User>(data: null) is a compile error, while
SuccessOperation<User?>(data: null) is allowed.
"Successful but no data"
Pick the type parameter that matches what the operation actually models:
// Fire-and-forget mutations (delete, logout, PIN confirm):
class DeleteCubit extends Cubit<OperationState<void>> { ... }
// Successful but the value may legitimately be absent:
class CurrentUserCubit extends Cubit<OperationState<User?>> { ... }
- Inheritance
-
- Object
- OperationState<
T> - SuccessOperation
- Available extensions
Constructors
- SuccessOperation({required T data, String? message})
-
Creates a success state with the operation's result data.
const
Properties
-
copyWith
→ SuccessOperation<
T> Function({T? data, String? message}) -
Copies this success state, preserving omitted fields.
no setteroverride
- data → T
-
The data associated with the successful operation.
Returns exactly
T, mirroring the type parameter.no setteroverride - dataOrNull → T?
-
The data associated with the operation, as a nullable
T?.no setterinherited - hasData → bool
-
Whether this state has associated data.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasNoData → bool
-
Whether this state has no associated data.
no setterinherited
- isError → bool
-
A convenience getter to check if the operation has encountered an error.
no setterinherited
- isIdle → bool
-
A convenience getter to check if the operation is idle.
no setterinherited
- isLoading → bool
-
A convenience getter to check if the operation is currently loading
and not an idle state.
no setterinherited
- isNotError → bool
-
A convenience getter to check if the operation has not encountered an
error.
no setterinherited
- isNotIdle → bool
-
A convenience getter to check if the operation is not idle.
no setterinherited
- isNotLoading → bool
-
A convenience getter to check if the operation is currently not loading.
no setterinherited
- isNotSuccess → bool
-
A convenience getter to check if the operation has not successfully loaded
data.
no setterinherited
- isSuccess → bool
-
A convenience getter to check if the operation has successfully loaded
data.
no setterinherited
- message → String?
-
An optional message associated with the successful operation.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transitionTo
→ AllTransitions<
T> -
Available on OperationState<
T> , provided by the OperationTransitions extensionno setter -
transitionTo
→ FromSuccess<
T> -
Available on SuccessOperation<
T> , provided by the SuccessTransitions extensionno setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override