You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing a web application where through a Drawer, the user has access to the different functionalities.
Being in /home, what I want to do is:
The user clicks on the item X of the Drawer.
The user navigates to page A with offAndToNamed.
User does something and navigates from A to B with toNamed.
The user does something and navigates from B to C with toNamed.
The user clicks on item X in the Drawer again. What I want the application to do is to remove C, B and A by destroying their respective controllers; and to rebuild A from scratch, i.e. rebuild its controller.
I create all the controllers using GetBuilder. I don't explicitly use Get.Put.
I have tried:
Get.offAllNamed(A): removes pages C, B, A with their respective controllers and navigates to A, but does not recreate the controller for A. This is obviously a problem.
Get.offNamedUntil(A, (route) => route.settings.name == /home): Exactly the same as offAllNamed.
Get.offAllNamed(/home); Get.offAndToNamed(A); : Exactly the same as in the two previous cases.
Get.offAllNamed('/home'); await Future.delayed(const Duration(milliseconds: 500)); Get.offAndToNamed(A) :After destroying the three controllers, it builds the controller of A again. If instead of 500 milliseconds, I set 250 for example, it does not build the controller of A. What is the point of this behaviour? It's as if it hasn't completely destroyed the controller of A and you have to give it some time to do so. If I put an await on the offAllNamed, the following lines of code are never executed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everybody!
I am implementing a web application where through a Drawer, the user has access to the different functionalities.
Being in /home, what I want to do is:
I create all the controllers using GetBuilder. I don't explicitly use Get.Put.
I have tried:
Get.offAllNamed(A)
: removes pages C, B, A with their respective controllers and navigates to A, but does not recreate the controller for A. This is obviously a problem.Get.offNamedUntil(A, (route) => route.settings.name == /home)
: Exactly the same as offAllNamed.Get.offAllNamed(/home); Get.offAndToNamed(A);
: Exactly the same as in the two previous cases.Get.offAllNamed('/home'); await Future.delayed(const Duration(milliseconds: 500)); Get.offAndToNamed(A)
:After destroying the three controllers, it builds the controller of A again. If instead of 500 milliseconds, I set 250 for example, it does not build the controller of A. What is the point of this behaviour? It's as if it hasn't completely destroyed the controller of A and you have to give it some time to do so. If I put an await on the offAllNamed, the following lines of code are never executed.Any ideas for possible strategies?
Thank you very much
Beta Was this translation helpful? Give feedback.
All reactions