【问题标题】:how to navigate and pass the data to other screen? Also need to clear that screen from back stack如何导航并将数据传递到其他屏幕?还需要从后台堆栈中清除该屏幕
【发布时间】:2019-09-15 22:29:01
【问题描述】:

我想从第一个屏幕导航到第二个屏幕。我想连同它一起发送一些数据。我还需要从返回堆栈中清除第一个屏幕,这样当我在第二个屏幕上按下返回按钮时它不应该进入第一个屏幕。

【问题讨论】:

    标签: flutter


    【解决方案1】:
    Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => 
      SecondPage(stuffToSend: "yourStuff")));
    
    class SecondPage{
     SecondPage({this.stuffToSend});
     var stuffToSend;
     //the rest of your code
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-27
      • 1970-01-01
      • 2022-01-20
      • 2020-07-27
      • 2018-06-09
      • 1970-01-01
      • 2019-10-23
      • 2022-10-07
      相关资源
      最近更新 更多