GetInstanceExt extension

Main extension on GetInterface providing dependency injection features.

on

Methods

call<T>() → T

Available on GetInterface, provided by the GetInstanceExt extension

A callable shortcut to find/retrieve a registered dependency.
delete<S>({String? tag, String? key, bool force = false}) bool

Available on GetInterface, provided by the GetInstanceExt extension

Delete registered Class Instance S (or tag) and, closes any open controllers DisposableInterface, cleans up the memory
deleteAll({bool force = false}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Deletes all registered instances from memory, invokes their onDelete/close lifecycles, and cleans up resources.
deleteRouteDependency(String key) → void

Available on GetInterface, provided by the GetInstanceExt extension

Deletes the dependency registered under key on behalf of a disposed route, keeping it alive when still-mounted widgets depend on it.
find<S>({String? tag}) → S

Available on GetInterface, provided by the GetInstanceExt extension

Finds the registered type <S> (or tag) In case of using Get.create to register a type <S> or tag, it will create an instance each time you call find. If the registered type <S> (or tag) is a Controller, it will initialize its lifecycle.
findOrNull<S>({String? tag}) → S?

Available on GetInterface, provided by the GetInstanceExt extension

Finds and returns the registered instance of type S if it exists, otherwise returns null.
getInstanceInfo<S>({String? tag}) InstanceInfo

Available on GetInterface, provided by the GetInstanceExt extension

isPrepared<S>({String? tag}) bool

Available on GetInterface, provided by the GetInstanceExt extension

Checks whether a lazy factory callback for type S (and optionally with tag) is registered and ready to be initialized.
isRegistered<S>({String? tag}) bool

Available on GetInterface, provided by the GetInstanceExt extension

Checks whether an instance of type S (and optionally with tag) is registered in memory.
lazyPut<S>(InstanceBuilderCallback<S> builder, {String? tag, bool? fenix, bool permanent = false}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Creates a new Instance lazily from the <S>builder() callback.
lazyReplace<P>(InstanceBuilderCallback<P> builder, {String? tag, bool? fenix}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Replaces an existing registered dependency of type P with a new lazy factory builder.
markAsDirty<S>({String? tag, String? key}) → void

Available on GetInterface, provided by the GetInstanceExt extension

put<S>(S dependency, {String? tag, bool permanent = false}) → S

Available on GetInterface, provided by the GetInstanceExt extension

Injects a dependency into the dependency manager and immediately initializes it.
putAsync<S>(AsyncInstanceBuilderCallback<S> builder, {String? tag, bool permanent = false}) Future<S>

Available on GetInterface, provided by the GetInstanceExt extension

Injects an instance of S built asynchronously by builder into the dependency manager.
putOrFind<S>(InstanceBuilderCallback<S> dep, {String? tag}) → S

Available on GetInterface, provided by the GetInstanceExt extension

Finds an existing registered instance of type S, or creates and registers a new one using dep if not already registered.
reload<S>({String? tag, String? key, bool force = false}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Reloads/restarts a specific registered dependency of type S.
reloadAll({bool force = false}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Reloads all registered instances by clearing their active dependency objects and resetting their initialization states.
replace<P>(P child, {String? tag}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Replaces an existing registered instance of type P with a new child instance.
spawn<S>(InstanceBuilderCallback<S> builder, {String? tag, bool permanent = true}) → void

Available on GetInterface, provided by the GetInstanceExt extension

Creates a new Class Instance S from the builder callbackS. Every time find() 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.