dart_ddi library

Classes

ApplicationFactory<BeanT extends Object>
Create an instance when first used and reuses it for all subsequent requests during the application's execution.
CustomBuilder<BeanT extends Object>
CustomBuilder is a class that represents how a Bean should be created. It is used to create a Bean after the registration in the DDI system.
DDI
DDI is an abstract class representing a Dependency Injection system. It provides methods for managing beans.
DDIBaseFactory<BeanT extends Object>
Abstract base class for all DDI factory implementations.
DDIInterceptor<BeanT extends Object>
Abstract class representing an interceptor for the Dart Dependency Injection (DDI) Library.
DDIScopeFactory<BeanT extends Object>
Abstract base class for DDI scope factories that support decorators, interceptors, and child modules.
DependentFactory<BeanT extends Object>
Create a new instance every time it is requested.
ObjectFactory<BeanT extends Object>
Creates a unique instance during registration and reuses it in all subsequent requests.
SingletonFactory<BeanT extends Object>
Creates a unique instance during registration and reuses it in all subsequent requests.

Enums

BeanStateEnum
Enum representing the different states a bean can be in during its lifecycle.

Mixins

DDIInject<InjectType extends Object>
Mixin that provides easy dependency injection for synchronous instances.
DDIInjectAsync<InjectType extends Object>
Mixin that provides easy dependency injection for asynchronous instances.
DDIModule
Mixin to make it easy to create modules
PostConstruct
Mixin that provides lifecycle hooks for post-construction initialization.
PreDestroy
Mixin that provides lifecycle hooks for pre-destruction cleanup.
PreDispose
Mixin that provides lifecycle hooks for pre-disposal cleanup.

Extensions

DDIGetExtension on DDI
Extension for DDI to retrieve instances of registered classes.
DDIRegisterExtension on DDI
P0 on BeanT Function()
Extensions to easily create CustomBuilders for functions with different numbers of parameters.
P1 on BeanT Function(A)
Extension for functions with 1 parameter (sync)
P10 on BeanT Function(A, B, C, D, E, F, G, H, I, J)
P2 on BeanT Function(A, B)
Extension for functions with 2 parameters (sync)
P3 on BeanT Function(A, B, C)
Extension for functions with 3 parameters (sync)
P4 on BeanT Function(A, B, C, D)
Extension for functions with 4 parameters (sync)
P5 on BeanT Function(A, B, C, D, E)
Extension for functions with 5 parameters (sync)
P6 on BeanT Function(A, B, C, D, E, F)
Extension for functions with 6 parameters (sync)
P7 on BeanT Function(A, B, C, D, E, F, G)
Extension for functions with 7 parameters (sync)
P8 on BeanT Function(A, B, C, D, E, F, G, H)
P9 on BeanT Function(A, B, C, D, E, F, G, H, I)
PF0 on Future<BeanT> Function()
Extension for functions with 0 parameters (async)
PF1 on Future<BeanT> Function(A)
Extension for functions with 1 parameter (async)
PF10 on Future<BeanT> Function(A, B, C, D, E, F, G, H, I, J)
PF2 on Future<BeanT> Function(A, B)
Extension for functions with 2 parameters (async)
PF3 on Future<BeanT> Function(A, B, C)
Extension for functions with 3 parameters (async)
PF4 on Future<BeanT> Function(A, B, C, D)
Extension for functions with 4 parameters (async)
PF5 on Future<BeanT> Function(A, B, C, D, E)
Extension for functions with 5 parameters (async)
PF6 on BeanT Function(A, B, C, D, E, F)
Extension for functions with 6 parameters (async)
PF7 on Future<BeanT> Function(A, B, C, D, E, F, G)
PF8 on Future<BeanT> Function(A, B, C, D, E, F, G, H)
PF9 on Future<BeanT> Function(A, B, C, D, E, F, G, H, I)

Properties

ddi DDI
Shortcut for getting the shared instance of the DDI class. The DDI class provides methods for managing beans.
final

Exceptions / Errors

BeanDestroyedException
Exception thrown when trying to use a bean that has been destroyed.
BeanNotFoundException
Exception thrown when trying to access a bean that doesn't exist in the DDI container.
BeanNotReadyException
Exception thrown when trying to access a bean that exists but is not ready yet.
ConcurrentCreationException
Exception thrown when multiple threads or async operations try to create the same instance simultaneously.
DuplicatedBeanException
Exception thrown when trying to register a bean that already exists in the DDI container.
FactoryAlreadyCreatedException
Exception thrown when trying to create a factory that has already been created and registered.
FactoryNotAllowedException
Exception thrown when trying to register a factory that is not valid for the specified type.
FutureNotAcceptException
Exception thrown when trying to access a Future-based factory using synchronous methods.