Container class

Container is used to register mappings between each abstraction (service) and its corresponding implementation (component).

Implementers

Constructors

Container([ContainerOptions options = const ContainerOptions()])

Properties

hashCode int
The hash code for this object.
no setterinherited
options ContainerOptions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addInstanceProducer(Type serviceType, InstanceProducer instanceProducer) → void
contains<TService>() bool
dispose() → void
get<TService>() → TService
Gets an instance of the given TService. Throws ActivationException when there are errors resolving the service instance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register<TService, TImplementation extends TService>(Constructor<TImplementation> constructor, [Lifestyle lifestyle = Lifestyle.transient]) → void
Registers a constructor for type TService. This constructor must be specified in constructor and must generate an instance of TImplementation which, in turn, must inherit from TService. Default value of lifestyle is Lifestyle.transient.
registerSimple<TService>(Constructor<TService> constructor, [Lifestyle lifestyle = Lifestyle.transient]) → void
Registers a constructor for type TService. This constructor must be specified in constructor and must generate an instance of TService. Default value of lifestyle is Lifestyle.transient.
toString() String
A string representation of this object.
inherited
unregister<TService>() → void
Unregisters the producer to TService, if it already registered.

Operators

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