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 GetConfig.currentRoute
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.
Uses tag
as the other methods.
Example:
Repl a = find();
Repl b = find();
print(a==b); (false)```
Implementation
void create<S>(InstanceBuilderCallback<S> builder,
{String? tag, bool permanent = true}) =>
GetInstance().create<S>(builder, tag: tag, permanent: permanent);