Learn

Scopes and overrides

Use local-first child resolution and explicit parent overrides without mutating the parent.

v0.1.0-dev.1Intermediateark_di

Scopes and overrides

A child container resolves its own registrations first, then delegates to its parent. Closing the child never closes the parent.

dart
final preview = application.createChild((binder) {
  binder.bindInstance<CatalogRepository>(
    MemoryCatalogRepository(items),
    overrideParent: true,
  );
  binder.bindLazySingleton<CatalogService>(
    (resolver) => CatalogService(resolver.get<CatalogRepository>()),
    overrideParent: true,
  );
});

An override must target an existing parent registration. If a parent Singleton has already captured the parent Repository, overriding only the Repository does not rebuild that consumer. Override the consumer in the child as well.

Use DiKey<T>.named when several configurations share one Dart type but remain semantically distinct.

ARKTELOS

Purpose-built engineering systems for software that has to hold.