ZenController class abstract

Base controller class with automatic memory leak prevention and smart DI

Implementers
Available extensions

Constructors

ZenController()

Properties

activeWatcherCount → int
Get count of active watchers (useful for debugging)
no setter
childControllerCount → int
Get count of tracked child controllers for debugging
no setter
childControllerStats → Map<String, int>
Get stats about child controllers
no setter
createdAt → DateTime
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
no setter
isInitialized → bool
no setter
isReady → bool
no setter
reactiveObjectCount → int
Get count of tracked reactive objects for debugging
no setter
reactiveStats → Map<String, int>
Get stats about reactive objects
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDisposer(void disposer()) → void
Add a disposer function that will be called when the controller is disposed
addUpdateListener(String updateId, VoidCallback listener) → void
Register a listener for a specific update ID
condition<T>(ValueNotifier<T> obs, bool condition(T), void callback(T)) → ZenWorker
createEffect<T>({required String name}) → ZenEffect<T>
Create an effect that will be auto-disposed with this controller
createWorkerGroup() → ZenWorkerGroup
Create a managed worker group
createWorkers(List<ZenWorker Function()> creators) → List<ZenWorker>

Available on ZenController, provided by the ZenControllerWorkerExtension extension

Create multiple workers in one call
debounce<T>(ValueNotifier<T> obs, void callback(T), Duration duration) → ZenWorker
didChangeAppLifecycleState(AppLifecycleState state) → void
Override from WidgetsBindingObserver to handle app lifecycle
dispose() → void
Dispose the controller and clean up ALL resources - PREVENTS MEMORY LEAKS
disposeWorkers(List<ZenWorker> workers) → void

Available on ZenController, provided by the ZenControllerWorkerExtension extension

Dispose specific workers
ever<T>(ValueNotifier<T> obs, void callback(T)) → ZenWorker
Type-safe convenience worker methods
getResourceStats() → Map<String, dynamic>
Get comprehensive resource usage statistics
getWorkerStats() → Map<String, dynamic>
Get worker statistics for debugging/monitoring
interval<T>(ValueNotifier<T> obs, void callback(T), Duration duration) → ZenWorker
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
obs<T>(T initialValue) → Rx<T>
Create and auto-track a reactive variable - PREVENTS MEMORY LEAKS
obsList<T>([List<T>? initialValue]) → RxList<T>
Create and auto-track a reactive list - PREVENTS MEMORY LEAKS
obsMap<K, V>([Map<K, V>? initialValue]) → RxMap<K, V>
Create and auto-track a reactive map - PREVENTS MEMORY LEAKS
obsSet<T>([Set<T>? initialValue]) → RxSet<T>
Create and auto-track a reactive set - PREVENTS MEMORY LEAKS
once<T>(ValueNotifier<T> obs, void callback(T)) → ZenWorker
onClose() → void
User-defined cleanup hook - called before internal disposal
onDetached() → void
Called when the app is detached
onHidden() → void
Called when the app is hidden
onInactive() → void
Called when the app is inactive
onInit() → void
Internal method called by child controllers to auto-register with parent This is called automatically during child controller construction if a parent exists
onPause() → void
Called when the app is paused (goes to background)
onReady() → void
onResume() → void
Called when the app is resumed (comes back to foreground)
pauseAllWorkers() → void
Pause all workers managed by this controller
pauseSpecificWorkers(List<ZenWorker> workers) → void

Available on ZenController, provided by the ZenControllerWorkerExtension extension

Pause specific workers
removeUpdateListener(String updateId, VoidCallback listener) → void
Remove a listener for a specific update ID
resumeAllWorkers() → void
Resume all workers managed by this controller
resumeSpecificWorkers(List<ZenWorker> workers) → void

Available on ZenController, provided by the ZenControllerWorkerExtension extension

Resume specific workers
throttle<T>(ValueNotifier<T> obs, void callback(T), Duration duration) → ZenWorker
toString() → String
A string representation of this object.
inherited
trackController<T extends ZenController>(T controller) → T
Track a child controller (like ZenQuery, ZenStreamQuery) for automatic disposal
trackReactive(Rx reactive) → void
Manually track a reactive object (for external reactive objects)
update([List<String>? updateIds]) → void
Optimized update method that can notify specific listeners or all listeners
watch<T>(ValueNotifier<T> observable, void callback(T), {WorkerType type = WorkerType.ever, Duration? duration, bool condition(T)?}) → ZenWorker
Create workers that auto-dispose with controller

Operators

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