inject<T> method
Injects and initializes given item
with args
.
Set withInjector
to inject given object.
Set withArgs
to init given object.
Initializable.init is called only when args
are not null.
Control provides static call for this function via Control.inject.
Implementation
void inject<T>(dynamic item,
{dynamic args, bool withInjector = true, bool withArgs = true}) {
if (withInjector && _injector != null) {
_injector!.inject<T?>(item, args);
}
if (withArgs && item is Initializable && args != null) {
item.init(args is Map ? args : Parse.toMap(args));
}
}