Zen class

Main Zenify API for dependency injection

Provides a clean, simple API for global dependency management. For hierarchical scopes, use ZenRoute or ZenProvider directly.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

activeFetches RxInt
Number of currently running query fetches globally.
no setter
activeMutations RxInt
Number of currently running mutations globally.
no setter
isFetching bool
Returns true if ANY query is currently fetching data from the network.
no setter
isMutating bool
Returns true if ANY mutation is currently executing.
no setter
queryCache ZenQueryCache
Shorthand for ZenQueryCache.instance.
no setter
rootScope ZenScope
Get the root scope for global dependencies
no setter

Static Methods

clearQueryCache() → void
Clear the query cache
createScope({String? name, ZenScope? parent}) ZenScope
Create a new scope for isolated dependencies
delete<T>({String? tag, bool force = false}) bool
Delete a dependency from root scope
deleteAll({bool force = false}) → void
Delete all dependencies from root scope
exists<T>({String? tag}) bool
Check if a dependency exists in root scope
find<T>({String? tag}) → T
Find a dependency in root scope (throws if not found)
findOrNull<T>({String? tag}) → T?
Find a dependency in root scope (returns null if not found)
getAllModules() Map<String, ZenModule>
Get all registered modules
getModule(String name) ZenModule?
Get a registered module by name
hasModule(String name) bool
Check if a module is registered
init({ZenStorage? storage, Map<String, ZenMutationHandler>? mutationHandlers, bool registerDevTools = true}) Future<void>
Initialize Zenify - call once at app startup
put<T>(T instance, {String? tag, bool? isPermanent}) → T
Register a dependency in root scope
putLazy<T>(T factory(), {String? tag, bool isPermanent = false, bool alwaysNew = false}) → void
Register a lazy factory in root scope
registerModules(List<ZenModule> modules, {ZenScope? scope}) Future<void>
Register and load modules with auto-dependency resolution
reset() → void
Complete reset - clear everything (for testing)
setNetworkStream(Stream<bool> stream) → void
Set a stream to monitor network connectivity status.
testMode() ZenTestMode
Enter test mode for easy mocking