Zen class

Main Zenify API for dependency injection Enhanced with debugging and introspection capabilities via debug package Clean atomic module system

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

allScopes List<ZenScope>
Get all active scopes in the system (for debugging)
no setter
currentScope ZenScope
Get the current active scope (for debugging and introspection)
no setter
rootScope ZenScope
Get the root scope for global dependencies
no setter

Static Methods

createScope({String? name, ZenScope? parent}) ZenScope
Create a new scope - the main way to work with dependencies
delete<T>({String? tag, bool force = false}) bool
Delete a dependency from root scope
deleteAll({bool force = false}) → void
Delete all dependencies from all scopes (mainly for testing)
dumpModules() String
Dump module registry for debugging with enhanced formatting
dumpScopes() String
Dump scope hierarchy for debugging with enhanced formatting
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)
findAllInstancesOfType<T>() List<T>
Find all instances of a specific type across all scopes
findOrNull<T>({String? tag}) → T?
Find a dependency in root scope, return null if not found
findScopeContaining(dynamic instance) ZenScope?
Find which scope contains a specific instance
generateSystemReport() String
Generate a comprehensive system report
getAllModules() Map<String, ZenModule>
Get all registered modules
getHierarchyInfo() Map<String, dynamic>
Get comprehensive debugging information about the entire scope hierarchy
getModule(String name) ZenModule?
Get a registered module by name
getSystemStats() Map<String, dynamic>
Get detailed statistics about the entire Zen system
hasModule(String name) bool
Check if a module is registered
init() → void
Initialize the system
put<T>(T instance, {String? tag, bool? isPermanent}) → T
Register a dependency in the root scope (convenience method)
putFactory<T>(T factory(), {String? tag}) → void
Register a factory in root scope
putLazy<T>(T factory(), {String? tag, bool? isPermanent}) → void
Register a lazy factory in root scope
registerModules(List<ZenModule> modules, {ZenScope? scope}) Future<void>
Register and load modules atomically with auto-dependency resolution
reset() → void
Complete reset - clear everything (for testing)
resetCurrentScope() → void
Reset current scope to root (useful for cleanup)
setCurrentScope(ZenScope scope) → void
Set the current scope (used internally by ZenRoute)