how to let get.back take some argument

my wish is when user hits back button on Page B to jump back to Page A, Get.back() is activated, but it should take an argument such as newCreatedId, I found something like Get.back(result: [newCreatedId]);, but I didn’t find tutorial how to let Page A get this argument, plz help me thanks!

>Solution :

the Get.back() with the result property is exactly what you need, and I will explain it to you:

so using Getx, when you’re trying to navigate to another route, we usually just call directly:;


in order to get some data from the MyOtherScreen(), it’s different a little bit, instead of calling just directly we need to assign its call to a variable like this:

var futureData =;

even if you assign it to a variable like this, it still works fine and navigates to MyOtherScreen() as expected.

after navigating, we are now in the MyOtherScreen(), after the user did what he needs to do on that page and wants to pop/back of that page with some data, you need to call:

Get.back(result: theDataFromMyOtherScreen);

what this will do:
it will close the MyOtherScreen() page and will store the theDataFromMyOtherScreen inside of the first variable where we assigned to it the

so the result after popping the page will be:

var futureData =; // futureData == theDataFromMyOtherScreen

now if you try to print it as example:

print(futureData); // will print the value of theDataFromMyOtherScreen

and every time you do the same routing process, it will store new data in that variable.

to recap:
the we called inside the variable navigates with us to the other page, and Get.back() will return us to the previous page with the value stored in the result property, so you can think of them that they are linked.

Leave a Reply