lazyBuilder<T extends Object?> method
Register a builder
function for creating a new instance
of T
with an id
optional as InstanceManageMode.builder.
Returns true
when instance has been registered.
It's a ways to manage an instance, which registers a builder function and creates the instance, unless it has already done so.
When the dependency tree no longer needs it, it is completely deleted, including deregistration (deleting the builder function).
It uses less RAM than factory and singleton, but it consumes more CPU than the other modes.
This method is equivalent to calling:
Reactter.register<T>(
builder,
id: id,
mode: InstanceManageMode.builder,
);
Implementation
bool lazyBuilder<T extends Object?>(
InstanceBuilder<T> builder, {
String? id,
}) {
return register<T>(
builder,
id: id,
mode: InstanceManageMode.builder,
);
}