create<S> method
Creates a new Class Instance S
from the builder callbackS
.
Every time find<S
>() is used, it calls the builder method to generate
a new Instance S
.
It also registers each instance.onClose()
with the current
Route Get.reference
to keep the lifecycle active.
Is important to know that the instances created are only stored per Route.
So, if you call Get.delete<T>()
the "instance factory" used in this
method (Get.create<T>()
) will be removed, but NOT the instances
already created by it.
Example:
Repl a = find();
Repl b = find();
print(a==b); (false)```
Implementation
void create<S>(
InstanceBuilderCallback<S> builder, {
String? tag,
bool permanent = true,
}) {
_insert(
isSingleton: false,
name: tag,
builder: builder,
permanent: permanent,
);
}