-
-
Notifications
You must be signed in to change notification settings - Fork 153
No type X is registered inside GetIt #77
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
I'm having the same issue - for now, the workaround is to transfer the boolean parameter (test) to the application running inside runApp() and use it there to initialize your services. |
I just replaced the import statements from relative to |
Thanks for you input @yanivshaked, but I went for the suggestion by @escamoteur. I changed the following import and some others to the package import style: @escamoteur, I'm not that clued up on Flutter just yet, so is the 'package:' import style the best way to do imports or is this because of some get_it internal workings that it works better that way? Thanks for your time and looking at my code, my latest commit on my repo has fixed all the tests. |
Please read this explanation here dart-lang/sdk#41868 I always recommend using package imports |
Thanks @escamoteur, I have read the other issue and will look at implementing that. I really appreciate the effort. |
Hi guys,
I'm only having issues using get_it when running tests in my Flutter app, otherwise it works perfectly. When registering the services I use a mock client, but that's not even the part giving a problem. The test which essentially runs the whole app, 'App loads flight correctly', succeeds, the only difference I can tell is that the one is a testWidget test (works), and the failing ones are normal tests.
Kindly see below errors I am getting, first it says that there is no type registered inside Getit and then when the next test runs and I try to register all the services again it suddenly says that the same type is already registered. I only did the second registering to try and see if it would make any difference.
My GitHub repo containing the below code as well as the full app can be found here.
Thanks in advance for anyone able to assist.
Registering code
Errors on flutter test
The text was updated successfully, but these errors were encountered: