getx
getx copied to clipboard
How to refresh the previous page when Get.back and Get.until
When using Get.to to push from A to B, how can I refresh A when pop form B? I cannot find any solution like this? Is there any solution like viewWillAppear in iOS?
A Page onTap:() async { var res = await Get.to(() => B()); // refresh A Page if (res != null && res == true) controller.refresh();
}
kindly give proper example cant understand
kindly give proper example cant understand
Future
// It will be executed only after you Get.back() from anotherPage. if (response != null) { // do something } }
I hope I have helped you @fisforfaheem =)
@pennyfine @ssthiago Thanks guys, it works perfectly when using Get.back()! But I have a more in-depth question: can I refresh when pop from deeper stack such as when route is A->B->C->D, make A refresh when pop from D directly using Get.until?
maybe this helps: https://stackoverflow.com/questions/66272880/flutter-how-to-automatically-trigger-a-function-when-a-route-was-pushed-on-to-t
@magic3584 for now you need to nest the Get.back(result: true). means in B-C-D all is calling Get.back(result: true) until it reaches A and in A u can refresh like the above answer..
I found another problem: It's not called when popped by swipe left to right. @pennyfine @ssthiago