Skip to content

impossible to unregister Singleton #270

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

Closed
fullflash opened this issue Apr 1, 2022 · 1 comment
Closed

impossible to unregister Singleton #270

fullflash opened this issue Apr 1, 2022 · 1 comment

Comments

@fullflash
Copy link

Hi.
unregister method seems only support factory objects not singletons.

is there a way to unregister singleton instances from get_it.

Object[/factory]() with  type BuylistBloc is not registered inside GetIt.
(Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;
Did you forget to register it?)
'package:get_it[/get_it_impl.dart]()':
package:get_it/get_it_impl.dart:1
Failed assertion: line 372 pos 7: 'instanceFactory != null'
#0      _AssertionError._doThrowNew (dart:core-patch[/errors_patch.dart:51:61]())
#1      _AssertionError._throwNew (dart:core-patch[/errors_patch.dart:40:5]())
#2      _GetItImplementation._findFactoryByNameAndType
package:get_it/get_it_impl.dart:372
#3      _GetItImplementation.get
package:get_it/get_it_impl.dart:393
#4      _GetItImplementation.call
package:get_it/get_it_impl.dart:430
@fullflash
Copy link
Author

the error happens if you do register without generic.

must registerSingleton instances providing class type as generic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant