ark_di library
Pure Dart dependency injection with hierarchical scopes, explicit ownership, deterministic async initialization, and ordered teardown.
Classes
- DiBinder
- Configures registrations before a dependency container becomes active.
- DiCloseFailure
- One failure observed while a container hierarchy was closing.
- DiContainer
- An immutable registration scope and runtime dependency resolver.
- DiDependencyDescriptor
- A non-generic description of one dependency registration.
-
DiKey<
T> - A type-safe key for a named dependency registration.
- DiResolver
- Resolves configured dependencies without exposing registration mutation.
Enums
- DiContainerState
- Runtime state of a dependency container.
- DiOwnership
- Ownership of an instance supplied directly to a container.
- DiRegistrationKind
- The creation and caching strategy of a dependency registration.
Typedefs
-
DiAsyncFactory<
T> = Future< T> Function(DiResolver resolver) - Creates a dependency asynchronously within the current resolution context.
-
DiDisposer<
T> = FutureOr< void> Function(T instance) -
Releases a container-owned
instancesynchronously or asynchronously. -
DiFactory<
T> = T Function(DiResolver resolver) - Creates a dependency synchronously within the current resolution context.
Exceptions / Errors
- DiAsyncResolutionRequiredException
- Thrown when synchronous access targets an asynchronous registration.
- DiCircularDependencyException
- Thrown when factories form a direct or indirect dependency cycle.
- DiCloseException
- Thrown after close attempted every teardown operation and some failed.
- DiConfigurationClosedException
- Thrown when a retained binder is used after configuration completes.
- DiContainerStateException
- Thrown when a container cannot accept the requested operation.
- DiDuplicateRegistrationException
- Thrown when the same key is registered twice in one container.
- DiException
-
Base class for failures produced by
ark_di. - DiNotFoundException
- Thrown when a dependency is absent from a container hierarchy.
- DiOverrideTargetNotFoundException
- Thrown when an explicit parent override has no registration to replace.
- DiOwnershipConfigurationException
- Thrown for an invalid instance ownership/disposer combination.
- DiParentRegistrationConflictException
- Thrown when a child registration shadows its parent without permission.
- DiResolutionContextExpiredException
- Thrown when a factory retains and later reuses its contextual resolver.