replaceFromModule<TModule extends EasyModule, TInstance extends Object> method
- @visibleForTesting
- @Deprecated('Use EasyDI.replaceFromModule instead')
- TInstance instance, {
- String? key,
Replaces an instance in a specific module.
This method directly replaces an instance in the specified module's injector. It is faster than replace since it targets a specific module rather than searching through all modules.
Example:
ModulesManager.instance.replaceFromModule<AuthModule, UserRepository>(
mockUserRepository,
);
Throws an Exception if the specified module is not found.
Implementation
@visibleForTesting
@Deprecated('Use EasyDI.replaceFromModule instead')
void replaceFromModule<TModule extends EasyModule, TInstance extends Object>(
TInstance instance, {
String? key,
}) =>
EasyDI.replaceFromModule<TModule, TInstance>(instance, key: key);