Closed AlexeyPoldeo closed 5 years ago
so you are able to get the dependency with that name later on? What is your use case for this feature?
Yes. Sometimes it's required to inject objects of same class, but different purposes. Like username and password - both are String.
Okay, we will do it. But you need always the type info. So it will looks like this:
injector.registerDependency<UserService>(dependencyName: "UserService2", (injector) => UserServiceImpl())..
and you get your dependency like this:
injector.getDependency<UserService>(dependencyName: "UserService2");
Are you fine with that?
In version 1.0.5 we added support for named dependencies
But this is not reflected in Readme...
It will be great to add optional name parameter on registering and getting an object