IocContainerBuilder class

👷 A builder for creating an IocContainer.

Constructors

IocContainerBuilder({bool allowOverrides = false})
👷 Creates a container builder

Properties

allowOverrides bool
🔃 Throw an error if a service is added more than once. Set this to true when you want to add mocks to set of services for a test.
final
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>(T factory(IocContainer container), {void dispose(T service)?}) → void
🏭 Add a factory to the container.
addAsync<T>(Future<T> factory(IocContainer container), {Future<void> disposeAsync(T service)?}) → void
⌛ Adds an async ServiceDefinition
addServiceDefinition<T>(ServiceDefinition<T> serviceDefinition) → void
📙 Add a factory to the container.
addSingleton<T>(T factory(IocContainer container)) → void
1️⃣ Add a singleton factory to the container. The container will only call this once throughout the lifespan of the container
addSingletonAsync<T>(Future<T> factory(IocContainer container)) → void
1️⃣ ⌛ Add an async singleton factory to the container. The container will only call the factory once throughout the lifespan of the container
addSingletonService<T>(T service) → void
Add a singleton service to the container.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toContainer() IocContainer
📦 Create an IocContainer from the IocContainerBuilder.
toString() String
A string representation of this object.
inherited

Operators

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