replace<T extends Object> method
- @Deprecated('Use EasyDI.replace instead')
- T instance, {
- String? key,
Replaces an instance in all modules that have registered it.
This method searches through all registered modules and replaces the instance in any module that has registered a dependency of type T. This is useful when you don't know which module owns the dependency, but it can be slower than replaceFromModule since it needs to check all modules.
Example:
ModulesManager.instance.replace<UserRepository>(mockUserRepository);
Implementation
@Deprecated('Use EasyDI.replace instead')
void replace<T extends Object>(T instance, {String? key}) => EasyDI.replace<T>(instance, key: key);