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

How can one ensure that each time entering PersonPage, it is a brand new instance of the personal home page for the respective user? #3243

Open
ddxl123 opened this issue Oct 21, 2024 · 3 comments

Comments

@ddxl123
Copy link

ddxl123 commented Oct 21, 2024

For example, there is a personal home page (PersonPage) with an associated PersonController.
When I go to my personal home page, find my followers list, and then visit the followers’ home pages,
I end up entering the PersonPage twice.

The first time I call Get.to(()=>PersonPage(userId:1)), PersonPage and PersonController are normally instantiated, and the constructor is also called.
However, the second time I call Get.to(()=>PersonPage(userId:2)), PersonPage and PersonController are not recreated.

How can one ensure that each time entering PersonPage, it is a brand new instance of the personal home page for the respective user?

I tried using Get.create/Get.spawn, but I’m not sure how to use it. Could you please provide a simple and easy-to-understand example? Thank you very much!

get: ^5.0.0-release-candidate-9.2
@WorkWithAfridi
Copy link

Why not initialize the controller inside the person page? Try doing that. Pass it required data via a model class, and initialize the controller inside the page or even better inject the controller.

@mohammadzeyadeh001
Copy link

mohammadzeyadeh001 commented Oct 26, 2024

read this :
https://github.com/jonataslaw/getx/blob/master/documentation/en_US/dependency_management.md#differences-between-methods

there is a lot to say about controller management , make sure to let ChatGPT to help you with your case scenario

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

4 participants
@ddxl123 @mohammadzeyadeh001 @WorkWithAfridi and others