UseInstance<T extends Object>.factory constructor
UseInstance<T extends Object>.factory (
- InstanceBuilder<
T> builder, [ - String? id
It's a ways to manage an instance, which registers a builder function only once and creates the instance if not already done.
When the dependency tree no longer needs it, the instance is deleted and the builder function is kept in the register.
It uses more RAM than builder
but not more than singleton,
and consumes more CPU than singleton but not more than builder
.
Implementation
factory UseInstance.factory(InstanceBuilder<T> builder, [String? id]) =>
UseInstance.create(
builder,
id: id,
mode: InstanceManageMode.factory,
);