Injector class abstract
Register and get binds
- Available Extensions
Constructors
- Injector()
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
-
add<
T> (Function constructor, {BindConfig< T> ? config, String? key}) → void - Register a factory instance. A new instance will be generated whenever requested.
-
addInstance<
T> (T instance, {BindConfig< T> ? config, String? key}) → void - Register a instance. A concrete object (Not a function).
-
addLazySingleton<
T> (Function constructor, {BindConfig< T> ? config, String? key}) → void -
Register a LazySingleton instance.
It will generate a single instance for the duration of
the application, or until manually removed.
The object will be started only when requested the first time. -
addSingleton<
T> (Function constructor, {BindConfig< T> ? config, String? key}) → void -
Register a Singleton instance.
It will generate a single instance for the duration of
the application, or until manually removed.
The object will be started as soon as it is registered. -
call<
T> ({ParamTransform? transform, String? key}) → T -
Request an instance by Type
transform
: Transform a param. This can be used for example to replace an instance with a mock in tests.
Whenkey
is provided it will search the instance that have the same key -
get<
T> ({ParamTransform? transform, String? key}) → T -
Request an instance by Type
transform
: Transform a param. This can be used for example to replace an instance with a mock in tests.
Whenkey
is provided it will search the instance that have the same key -
getNotifier<
T> ({String? key}) → dynamic -
Request an notifier property by Type
Whenkey
is provided it will search the instance that have the same key -
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