ContainerProvider class
Provides a globally accessible dependency injection container instance.
This provider serves as a central access point for the application's dependency injection container, allowing services to be resolved without manually passing the container instance throughout the codebase. It follows the singleton pattern to ensure a single container instance is used throughout the application lifecycle.
Example usage:
// Register a service
ContainerProvider.instance.bind<Logger>((container) => ConsoleLogger());
// Resolve a service
final logger = ContainerProvider.instance.resolve<Logger>();
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → ContainerInterface
-
Gets the global container instance.
no setter