-
-
Notifications
You must be signed in to change notification settings - Fork 153
Registration ordering #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can use |
In general, yes you have to ensure the corrcect sequence of registration. there is support to esure that asynchronous created objects are available before other objects need to acces them but they have to be registered in the correct sequence. |
Thanks for your reply. We are currently using this package here: https://pub.dev/packages/flutter_simple_dependency_injection. I don't know in detail how it works, but we do not need to care about the ordering of registrations. |
I think I understand the difference now. Your other package uses always factory functions which means that you can't run into a dependency problem while you register all your types. If you register all your types as |
Thanks for the explanation. We'll have a look and try the |
We would like to use get_it for our project, but we are confused how the registration process works. Did we understand the documentation correctly that we need to register the dependencies manually in the correct order?
Let's say we have a
ServiceA
andServiceB
which depends onServiceA
. We then manually need to make sure that we first registerServiceA
before we registerServiceB
?Our previous IoC container was able to resolve the dependencies automatically. If we switch to get_it, we would have to manually reorder about a hundred dependencies. Even once the dependencies are ordered, each new dependency registration must also be in the right place. With many dependencies, this can be quite difficult to maintain.
Is this a current limitation of get_it or did we misunderstand the documentation? And do you know a strategy how to deal with this kind of issue? Anyways, thanks for your great work!
The text was updated successfully, but these errors were encountered: