Skip to content
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

Can't delete GetxService with force: true #1026

Closed
Apollo108 opened this issue Jan 20, 2021 · 7 comments
Closed

Can't delete GetxService with force: true #1026

Apollo108 opened this issue Jan 20, 2021 · 7 comments
Assignees

Comments

@Apollo108
Copy link

Apollo108 commented Jan 20, 2021

Screenshots
image
image
image

Why service doesn't get deleted, despite logs are saying it did?
As seen from the screenshot, I can access it afterwards. Thank you in advance!

Expected behavior
Error, when trying to access deleted service with Get.find()

Flutter Version:
1.22.5

Getx Version:
3.24.0

@eduardoflorence
Copy link
Collaborator

Only Get.reset().
https://github.com/jonataslaw/getx#getxservice

@Apollo108
Copy link
Author

Apollo108 commented Jan 20, 2021

Thank you for the fast response. But Get.reset() will destroy everything, and I need to do that selectively. Is there any option for that purpose? Probably I can use GetxController instead? Will delete() work for it?

@eduardoflorence
Copy link
Collaborator

Exactly, if you use GetxController you can do the selective Delete

@Apollo108
Copy link
Author

Apollo108 commented Jan 20, 2021

Just attempted to do this - the result is exactly the same as for GetxService... And I also noticed that I can find controllers after being disposed. @eduardoflorence, do you have any clue why?

@Apollo108
Copy link
Author

@jonataslaw I'm sorry, but can I expect any answer from you, or anybody? Thank you in advance)

@eduardoflorence
Copy link
Collaborator

@Apollo108, replace

static FakeService to = Get.find();

with

static FakeService get to => Get.find();

@Apollo108
Copy link
Author

You just saved my day, good sir! Omg, a GetxService gets deleted too! Thank you very much, I think your response deserves to be carved in the tables of documentation to this awesome library!)

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

3 participants