PulseXInjector class

Very simple and easy to use service locator You register your object creation factory or an instance of an object with register, or registerLazySingleton And retrieve the desired object using find or call your locator as function as its a callable class

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

find<T>() → T
Get registered dependency in DI container Specify requested dependency type via T If the requested dependency is not found, Pulse will throw Injection Error
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register<T>(dynamic service) → void
In register method, DI container creates a new instance of the registered dependency every time it's requested On the other hand, a new instance is injected in every injection and ensures that each consumer receives a unique instance
registerLazySingleton<T>(T serviceFactory()) → void
In registerLazySingleton method, DI container creates a new instance of the registered dependency when it's first requested Subsequent requests will return the same instance that was initially created at the first request
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance PulseXInjector
get instance of PulseXInjector If instance is null, it initializes instance by locking to ensure that a single async process runs without conflict
no setter