KiwiContainer class

A simple service container.

Constructors

KiwiContainer()
Always returns a singleton representing the only container to be alive.
factory
KiwiContainer.scoped()
Creates a scoped container.

Properties

hashCode int
The hash code for this object.
no setterinherited
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

Methods

call<T>([String? name]) → T
clear() → void
Removes all instances and builders from the container.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerFactory<S>(Factory<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>(Factory<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