Recipes

Choose Instance or Factory

Distinguish a supplied retained registration from a transient object created for each request.

v0.1.0-dev.1Intermediateark_di

Choose Instance or Factory

dart
binder.bindInstance<AppConfig>(config);
binder.bindFactory<RequestContext>((resolver) => RequestContext());

An Instance is supplied once and remains registered. Its default owner is the container; use ownership: DiOwnership.external when another scope controls cleanup. A Factory creates a transient object per resolution and the container does not retain its results.

ARKTELOS

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