UseInstance<T extends Object>.singleton constructor
UseInstance<T extends Object>.singleton (
- InstanceBuilder<
T> builder, [ - String? id
It's a ways to manage a instance, which registers a builder function and creates the instance only once.
This mode preserves the instance and its states, even if the dependency tree stops using it.
Use Reactter.destroy
if you want to force destroy
the instance and its register.
It consumes less CPU than builder
and factory,
but uses more RAM than the other modes.
Implementation
factory UseInstance.singleton(InstanceBuilder<T> builder, [String? id]) =>
UseInstance.create(
builder,
id: id,
mode: InstanceManageMode.singleton,
);