flutter - Flutter 应用程序中最好的路由方式是什么

标签 flutter flutter-routes

Flutter 应用程序中最好的路由方式是什么? 我尝试过命名路线、路线数组、 flutter 导航2.0。但我仍然不确定哪个是最好的。

最佳答案

Flutter docs建议使用go_router导航包。


说明:

普通方法的局限性

Although named routes can handle deep links, the behavior is always the same and can’t be customized. When a new deep link is received by the platform, Flutter pushes a new Route onto the Navigator regardless where the user currently is.

建议的更好方法

Flutter applications with advanced navigation and routing requirements (such as a web app that uses direct links to each screen, or an app with multiple Navigator widgets) should use a routing package such as go_router that can parse the route path and configure the Navigator whenever the app receives a new deep link.


有关 go_router 的引用问题:

关于flutter - Flutter 应用程序中最好的路由方式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68358147/

相关文章:

flutter - StreamProvider未更新列表

flutter - 如何在checkboxlisttile中的flutter中选择多个复选框

flutter - 使用 page_transition 更改 Navigator.pop() 动画持续时间

flutter - 根据最小尺寸包裹小部件,然后拉伸(stretch)它们以填充可用宽度

google-drive-api - Dart/flutter : download or read the contents of a Google Drive file

flutter - 收到推送通知但未显示(Flutter/Dart)

Flutter/Dart - 在 PageView 中编辑页面,然后刷新并滚动回同一个地方?

flutter - 我想将数据从第二屏幕传递到第一屏幕

flutter - 如何将参数传递给命名路由中的小部件?