di library
Dependency injection container
Classes
- DIContainer
- Dartian Dependency Injection Container Wraps get_it to provide a simpler API with cycle detection
- DIModule
- Base class for DI modules Modules are used to group related service registrations
- LazySingleton
- Marks a class as a lazy singleton Similar to @Singleton but the instance is created on first access
- Module
- Marks a class as a module that groups related service registrations Modules help organize large applications by grouping related services
- Named
- Marks a parameter as injectable Used to specify which dependency to inject when there are multiple implementations
- Provides
- Marks a method in a Module as a provider The method will be used to create and register the service
- Service
- Marks a class as a factory service A new instance will be created on each request
- ServiceProvider
- Base class for service providers Service providers are used to register services with the container
- SimpleModule
- A simple module implementation
- Singleton
- Annotations for automatic service discovery and registration Used with build_runner for code generation Marks a class as a singleton service The service will be registered once and the same instance returned on each request
Extensions
- DIModuleExtension on DIModule
- Extension to make module usage easier
Exceptions / Errors
- CircularDependencyException
- Exception thrown when a circular dependency is detected