spawn<S> method

void spawn<S>(
  1. InstanceBuilderCallback<S> builder, {
  2. String? tag,
  3. bool permanent = true,
})

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.spawn<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 spawn<S>(
  InstanceBuilderCallback<S> builder, {
  String? tag,
  bool permanent = true,
}) {
  _insert(
    isSingleton: false,
    name: tag,
    builder: builder,
    permanent: permanent,
  );
}