gpt4 book ai didi

从另一个屏幕移回屏幕后 flutter 调用函数

转载 作者:行者123 更新时间:2023-12-04 10:53:12 25 4
gpt4 key购买 nike

从另一个屏幕移回屏幕后,如何在 flutter 中调用函数?

例如:

屏幕 1

function1(){
}

屏幕 2
function2(){
//Go back to screen 1 and then call function1()
}

最佳答案

这很简单。

Navigator.push(context, MaterialPageRoute(builder: (context)=> SecondScreen())).then((_){
// This method gets callback after your SecondScreen is popped from the stack or finished.
function1();
});

您还应该引用 Flutter Navigation & Routing.

关于从另一个屏幕移回屏幕后 flutter 调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59368399/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com