Container class

Concrete implementation of ServiceContainer.

Use Container.root to create the root container.

Implemented types

Constructors

Container.root()
Creates the root container and auto-registers itself.
factory

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

allReady() Future<void>
Waits for all async initialization tasks.
override
bind<T>({String? name, required T factory(ServiceContainer container, Map<String, dynamic>? options)}) → void
Registers a transient factory.
override
bindInstance<T>(T instance, {String? name}) → void
Binds an existing instance.
override
contains<T>({String? name}) bool
Checks registration in this container and parents.
override
dispose() Future<void>
Disposes resources and runs cleanup callbacks.
override
disposeBinding<T>({String? name}) Future<bool>
remove a binding from the container dispose-> a container disposeBinding -> a container-binding
override
initialize() Future<void>
Initializes eager singletons.
override
listRegistrations() Map<String, List<String>>
Returns registration metadata.
override
make<T>({String? name, Map<String, dynamic>? options}) → T
Resolves a service.
override
newScope() ServiceContainer
Creates a child scope.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose(Future<void> callback()) → void
Registers a disposal callback.
override
singleton<T>({String? name, required T factory(ServiceContainer container, [Map<String, dynamic>? options]), bool eager = false}) → void
Registers a singleton with optional eager loading.
override
toString() String
A string representation of this object.
inherited
tryMake<T>({String? name, Map<String, dynamic>? options}) → T?
Safely resolves a service.
override

Operators

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