-
-
Notifications
You must be signed in to change notification settings - Fork 153
Object/factory with with name __environments__ and type Set<String> is already registered inside GetIt. #124
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
What do you mean with two configurations? |
im trying to join two separate DI, in mainGetIt i need one class from module with all it dependencies |
Sorry I was missing |
I have same problem. My code
isRegistered always returns false, and the second time I run this code, registerSingleton fails saying that this class is already registered My get_it version: 5.0.1 |
@ReniDelonzek No, you have another problem :-) What you are doing here isRegistered(instance: HiveService())) is that you create a completely new GetIt.I.isRegistered<HiveService>(); But I also would question why do you check this at all? Maybe there is a better approach. Cheers |
Oh, it is work! Sorry, my first use this lib, Alias, congratulations on the excellent work done on it! My use case is as follows: The code that I run next depends on this service being registered correctly in GetIT. And as it is a new isolate, I have to register inside it In this situation I have no way of knowing when this code is running for the first time (which would be the only time I need to register), so this conditional to know if it is already registered or not. If you have any suggestions for a better approach that I can take, please, I would greatly appreciate receiving. Thank you! |
Ah, understood cool Am 28.10.2020 15:42 schrieb Reni Delonzek <[email protected]>:
GetIt.I.isRegistered<HiveService>();
Oh, it is work!
Sorry, my first use this lib, Alias, congratulations on the excellent work done on it!
My use case is as follows:
I have a function that is triggered by Firebase's onBackgroundMessage, so it runs in a new isolate.
The code that I run next depends on this service being registered correctly in GetIT. And as it is a new isolate, I have to register inside it
In this situation I have no way of knowing when this code is running for the first time (which would be the only time I need to register), so this conditional to know if it is already registered or not.
If you have any suggestions for a better approach that I can take, please, I would greatly appreciate receiving. Thank you!
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hello
Im using two configuration of getIt, one in main project and one in other module. When both configurations meet, there is error:
Object/factory with with name __environments__ and type Set<String> is already registered inside GetIt.
It was working before on older version.
The text was updated successfully, but these errors were encountered: