KiwiContainer class
A simple service container.
Constructors
- KiwiContainer()
-
Always returns a singleton representing the only container to be alive.
factory
- KiwiContainer.scoped({KiwiContainer? parent})
- Creates a scoped container.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
namedProviders
→ Map<
_ProviderName?, _ProviderValue> -
All named providers values registered in the container.
no setter
-
providers
→ Map<
_ProviderName?, _ProviderValue> -
All providers registered in the container,
including named our unnamed instances and builders.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- silent ↔ bool
-
Whether ignoring KiwiErrors in the following cases:
getter/setter pair
-
unnamedProviders
→ Map<
_ProviderName?, _ProviderValue> -
All unnamed providers values registered in the container.
no setter
Methods
-
call<
T> ([String? name]) → T -
clear(
) → void - Removes all instances and builders from the container.
-
isRegistered<
T> ({String? name}) → bool -
Returns if an instance or builder of type
T
is registered. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerFactory<
S> (FactoryBuilder< S> factory, {String? name}) → void - Registers a factory into the container.
-
registerInstance<
S> (S instance, {String? name}) → void - Registers an instance into the container.
-
registerSingleton<
S> (FactoryBuilder< S> factory, {String? name}) → void - Registers a factory that will be called only only when accessing it for the first time, into the container.
-
resolve<
T> ([String? name]) → T -
Attemps to resolve the type
T
. -
resolveAs<
S, T extends S> ([String? name]) → T? -
Attemps to resolve the type
S
and tries to cast it to T. -
toString(
) → String -
A string representation of this object.
inherited
-
unregister<
T> ([String? name]) → void -
Removes the entry previously registered for the type
T
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited