AirDI class
A centralized Service Locator for the Air Framework.
Features:
- Overwrite Protection: Prevents accidental overwriting of services by default.
- Audit Logging: Logs all registration attempts and access violations.
- Ownership Tracking: Keeps track of which module registered each dependency.
- Module Cleanup: Allows unregistering all dependencies of a specific module during its disposal.
Properties
-
debugRegisteredTypes
→ List<
String> -
Returns a list of all registered types as strings for debugging/DevTools purposes.
no setter
-
debugRegistrationInfo
→ Map<
String, String?> -
Returns a map of registered types and their owner modules for debugging/DevTools purposes.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Clears all registrations in the container.
-
get<
T> () → T -
Retrieves a registered dependency of type
T. -
getOwner<
T> () → String? -
Returns the ID of the module that registered the dependency of type
T. -
isRegistered<
T> () → bool -
Returns
trueif a dependency of typeTis currently registered. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register<
T> (T instance, {String? moduleId, bool allowOverwrite = false}) → void - Registers a dependency as a Singleton.
-
registerFactory<
T> (T factory(), {String? moduleId, bool allowOverwrite = false}) → void - Registers a Factory.
-
registerLazySingleton<
T> (T factory(), {String? moduleId, bool allowOverwrite = false}) → void - Registers a Lazy Singleton.
-
registerSingleton<
T> (T instance, {String? moduleId, bool allowOverwrite = false}) → void - Registers a dependency as a Singleton (Immediate).
-
toString(
) → String -
A string representation of this object.
inherited
-
tryGet<
T> () → T? -
Tries to retrieve a registered dependency of type
T. -
unregister<
T> ({String? callerModuleId}) → bool -
Unregisters a dependency of type
T. -
unregisterModule(
String moduleId) → void -
Unregisters all dependencies that belong to a specific
moduleId.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited