InstanceExtension<T> extension
Extension on GetInterface
providing a convenient method to find instances of type T
.
- on
Methods
-
call(
) → T -
Available on GetInterface, provided by the InstanceExtension extension
Callsfind<T>()
to retrieve an instance of typeT
. -
delete<
S> ({String? tag, String? key, bool force = false}) → bool -
Available on GetInterface, provided by the InstanceExtension extension
Delete registered Class InstanceS
(ortag
) and, closes any open controllersDisposableInterface
, cleans up the memory -
deleteAll(
{bool force = false}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Deletes all registered class instances and closes any open controllers that implementDisposableInterface
. -
find<
S> ({String? tag}) → S -
Available on GetInterface, provided by the InstanceExtension extension
Finds the registered type <S
> (ortag
) In case of using Get.create
to register a type <S
> ortag
, it will create an instance each time you call find. If the registered type <S
> (ortag
) is a Controller, it will initialize it's lifecycle. -
findOrNull<
S> ({String? tag}) → S? -
Available on GetInterface, provided by the InstanceExtension extension
The findOrNull method will return the instance if it is registered; otherwise, it will return null. -
getInstanceInfo<
S> ({String? tag}) → InstanceInfo -
Available on GetInterface, provided by the InstanceExtension extension
Get instance info -
isPrepared<
S> ({String? tag}) → bool -
Available on GetInterface, provided by the InstanceExtension extension
Checks if a lazy factory callbackGet.lazyPut()
that returns an Instance<S
> is registered in memory. -
isRegistered<
S> ({String? tag}) → bool -
Available on GetInterface, provided by the InstanceExtension extension
Check if a Class Instance<S
> (ortag
) is registered in memory. -
lazyPut<
S> (InstanceBuilderCallback< S> builder, {String? tag, bool? fenix, bool permanent = false}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Creates a new Instancelazily from the<S>builder()
callback. -
lazyReplace<
P> (InstanceBuilderCallback< P> builder, {String? tag, bool? fenix}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Replaces a parent instance with a new Instance -
markAsDirty<
S> ({String? tag, String? key}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Mark instance as a dirty -
put<
S> (S dependency, {String? tag, bool permanent = false}) → S -
Available on GetInterface, provided by the InstanceExtension extension
Injects an instance<S>
in memory to be globally accessible. -
putAsync<
S> (AsyncInstanceBuilderCallback< S> builder, {String? tag, bool permanent = false}) → Future<S> -
Available on GetInterface, provided by the InstanceExtension extension
async version ofGet.put()
. Awaits for the resolution of the Future frombuilder()
parameter and stores the Instance returned. -
putOrFind<
S> (InstanceBuilderCallback< S> dep, {String? tag}) → S -
Available on GetInterface, provided by the InstanceExtension extension
Registerd instance and if already exists then it will return -
reload<
S> ({String? tag, String? key, bool force = false}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Reloads the instance of typeS
. -
reloadAll(
{bool force = false}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Reloads all registered class instances. -
replace<
P> (P child, {String? tag}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Replace a parent instance of a class in dependency management with achild
instance -
spawn<
S> (InstanceBuilderCallback< S> builder, {String? tag, bool permanent = true}) → void -
Available on GetInterface, provided by the InstanceExtension extension
Creates a new Class InstanceS
from the builder callbackS
. Every time find<S
>() is used, it calls the builder method to generate a new InstanceS
. It also registers eachinstance.onClose()
with the current RouteGet.reference
to keep the lifecycle active. Is important to know that the instances created are only stored per Route. So, if you callGet.delete<T>()
the "instance factory" used in this method (Get.spawn<T>()
) will be removed, but NOT the instances already created by it.