lazyBuilder<T extends Object?> method
Register a builder
function of the T
dependency with/without id
as DependencyMode.builder.
Returns true
when dependency 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: DependencyMode.builder,
);
Implementation
bool lazyBuilder<T extends Object?>(
InstanceBuilder<T> builder, {
String? id,
}) {
return register<T>(
builder,
id: id,
mode: DependencyMode.builder,
);
}