如何完成飞镖 class 从一个 class 导航到另一个 class 就像 android 本机应用程序(完成前一个 class)?

how to finish dart class from navigate one class to another class like android Native Applications(finish the previous class)?

如果我们从屏幕一导航到屏幕二,我将如何完成屏幕一,class 在后台(目前,第一个屏幕仍在后台,即未完成)

在导航到下一个屏幕之前调用 Navigator.of(context).pop()。

你也可以使用更方便的方法pushReplacement

Navigator.pushReplacement(context, MaterialPageRoute(builder: (BuildContext context) => NewPage()));

In Flutter You Can User Navigator.of(context).pop();

below code, close your current page, navigate and open your new page.

Navigator.of(context)..pop()..pushNamed("/ui/dashbord", arguments:{});

在您可以使用路由名称访问所有 classes 之后,在主 class 中定义所有路由路径。

在 dart 中,我们可以使用“..”运算符在单行中用于 运行 多个语句。

您可以使用 WillPopScope 小部件并取消后退按钮请求,这样页面就不会返回

Widget build(BuildContext context) {  
    return 
    WillPopScope(
    onWillPop: () async {
          Future.value(
              false); //return false
        },
    child:
    Scaffold( //scaffold code)

    );
  }

您还可以在 AppBar 小部件中设置以下内容以隐藏后退按钮

automaticallyImplyLeading: false