Zen class

Main Zenify API for dependency injection

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

Available extensions

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

currentScope ZenScope
Get the current active scope (for internal use)
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() → 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)
resetCurrentScope() → void
Reset current scope to root
setCurrentScope(ZenScope scope) → void
Set current scope (used by routing/navigation)
setNetworkStream(Stream<bool> stream) → void
Set a stream to monitor network connectivity status.
testMode() ZenTestMode
Enter test mode for easy mocking