Search code examples
flutterargumentsflutter-getx

using getx get.arguments in flutter breaks when doing a hot-reload


Using GetX with Flutter, I pass data between parent controller/screen to its child controller/screen using Get.arguments.

The issue is that when doing a hot-reload while working on a child Get.arguments, the parent gets re-instantiated with the arguments of the current controller/screen.

This issue is described here.

Is that a bug, or something that can't be avoided?
I use the Get.arguments in the controllers but still experiencing this issue...

Any suggestions?


Solution

  • since Get.arguments get it's value from the previous page, using it directly in your code will normally throw an error saying that it's null on hot reload/restart because it update the state

    try saving Get.arguments first in a dynamic variable then use that varibale in your code