Container class

This is a Dependency Injection container. Use it as is or inherit from ContainerMixin to extend functionality.

Mixed in types

Constructors

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

Methods

get<T>([String name = '']) → T
Returns the service instance for type T. Specify name to get the named instance.
inherited
getCached<T extends Object>([String name = '']) → T?
Returns the service instance for type T if it has already been instantiated. Provide name to get the named instance.
inherited
has<T>([String name = '']) bool
Returns true if the service is registered in the container
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provide<T extends Object>(FactoryFun<T> factory, {String name = '', bool cached = true}) → void
Registers a service factory of type T in the container. Specify name to have several (named) factories of the same type. By default, all services are singletons. Set cached to false to get a new instance each time the service is requested.
inherited
toString() String
A string representation of this object.
inherited

Operators

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