clear method
Clears whole Factory - all stored objects, initializers and injector.
Also BaseLocalization
, ControlBroadcast and ControlRoute is removed and cleared/disposed.
Call this function only if Factory re-init is required. After clear is possible to call Control.initControl again.
Returns true
if factory is cleared. false
means, that factory is not initialized yet.
Implementation
bool clear() {
if (!_initialized) {
return false;
}
_initialized = false;
_completer = Completer();
_items.forEach((key, value) {
if (value is Disposable) {
value.dispose();
}
});
_items.clear();
_factory.clear();
_initialized = false;
_injector = null;
return true;
}