ZenEffect<T> class

A reactive effect that manages async operations with loading, data, and error states Uses the Zen reactive system for consistent API and optimal performance

Available extensions

Constructors

ZenEffect({required String name})

Properties

data → Rx<T?>
The current data value - using Rx for consistent reactive behavior
no setter
dataWasSet → RxBool
Whether data has been set at least once - using RxBool for consistent reactive behavior
no setter
error → Rx<Object?>
The current error, if any - using Rx for consistent reactive behavior
no setter
hasData → bool
Whether the effect has data (including null data that was explicitly set)
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Whether this effect has been disposed
no setter
isLoading → RxBool
Whether the effect is currently loading - using RxBool for consistent reactive behavior
no setter
name → String
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearData() → void
Clear only the data
clearError() → void
Clear only the error state
dispose() → void
Dispose the effect and clean up resources
loading() → void
Set the loading state
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Reset the effect to initial state
run(Future<T> operation()) → Future<T?>
Run an async operation with automatic state management Returns null if the effect is disposed during execution
setError(Object error) → void
Set error state
success(T? data) → void
Set successful data
toString() → String
A string representation of this object.
override
watch(ZenController controller, {void onData(T?)?, void onLoading(bool)?, void onError(Object?)?, String? name}) → void Function()

Available on ZenEffect<T>, provided by the ZenEffectWatch extension

Unified watch method for all effect aspects using ZenWorkers directly
watchData(ZenController controller, void callback(T?), {String? name}) → void Function()

Available on ZenEffect<T>, provided by the ZenEffectWatch extension

Convenience method for watching only data changes
watchError(ZenController controller, void callback(Object?), {String? name}) → void Function()

Available on ZenEffect<T>, provided by the ZenEffectWatch extension

Convenience method for watching only error state
watchLoading(ZenController controller, void callback(bool), {String? name}) → void Function()

Available on ZenEffect<T>, provided by the ZenEffectWatch extension

Convenience method for watching only loading state

Operators

operator ==(Object other) → bool
The equality operator.
inherited