disposeModule<T extends EasyModule> static method
Disposes a module and reloads all modules that depend on it.
This method disposes the module and then reloads all modules that depend on it. After disposing, it will:
- Reset the module's state and injector
- Re-process its imports to ensure dependencies are properly linked
- Recursively reload any modules that depend on this one
Example:
await EasyDI.disposeModule<UserModule>();
Throws an Exception if the module is not found in the manager.
Implementation
static Future<void> disposeModule<T extends EasyModule>() async {
final module = _modules[T] as T?;
if (module == null) {
throw Exception('[$EasyDI] module "$T" not found.');
}
await module.reset();
_proccessModuleImports<T>(module);
await _reloadModulesThatDependOn(module);
}