delete<T> static method
Deletes a singleton instance of a class from the dependency store.
Returns true
if the deletion is successful, false
otherwise.
If the class is not found in the dependency store, a log message will be printed.
If the deleted class is a ReactiveController, its onClose()
method will be called before deletion.
Implementation
static bool delete<T>({String? tag}) {
final key = _getKey(T, tag: tag);
if (_dependencyStore[key] == null) {
Logger.info('class $T is tried to delete but not present in the Dependency store');
return false;
} else {
if (_dependencyStore[key] is ReactiveController) {
Logger.info('$T onClose() method called');
(_dependencyStore[key] as ReactiveController).onClose();
}
_dependencyStore[key] = null;
Logger.info('class $T is deleted from the Dependency store');
return true;
}
}