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/