I think there is something wrong on how Get handles Controller injection and life cycle
Describe the bug
I think it is more easy to describe this with an example:
We have 3 screens, the home screen, the second screen and the third screen.
When the user navigates from homescreen to second screen, a SecondScreenController is put( Get.put(GenericController(timeStamp)) ).
The generic controller receives a timestamp ( with value 1), and then there is a widget that displays that particular timestamp (aka 1).
From the second screen there is a button to go to third screen, this is just a simple widget screen, and on the third screen there is a button to go to second screen and remove all previous screens with Get.offAllNamed('/second');
Now the Second screen is instantiated, the screen displays correctly the new timestamp (2) but then instead of closing the controller that was generated, the one with timestamp 1, it will close controller with timestamp 2.
**Reproduction code
I have a simple flutter app, that only has get: 4.6.5. I have given an example of the code below
I think there is something wrong on how Get handles Controller injection and life cycle
Describe the bug I think it is more easy to describe this with an example: We have 3 screens, the home screen, the second screen and the third screen. When the user navigates from homescreen to second screen, a SecondScreenController is put(
Get.put(GenericController(timeStamp))
). The generic controller receives a timestamp ( with value 1), and then there is a widget that displays that particular timestamp (aka 1). From the second screen there is a button to go to third screen, this is just a simple widget screen, and on the third screen there is a button to go to second screen and remove all previous screens withGet.offAllNamed('/second');
Now the Second screen is instantiated, the screen displays correctly the new timestamp (2) but then instead of closing the controller that was generated, the one with timestamp 1, it will close controller with timestamp 2.**Reproduction code
I have a simple flutter app, that only has
get: 4.6.5
. I have given an example of the code belowexample:
To Reproduce Steps to reproduce the behavior:
Expected behavior It should close the first SecondScreenController not the one you are currently using
Flutter Version: 3.0.3
Getx Version: 4.6.5