【问题标题】:How can you change URL in the web browser without named routes如何在没有命名路由的情况下更改 Web 浏览器中的 URL
【发布时间】:2023-01-25 19:38:59
【问题描述】:

自从 "named routes are no longer recommended for most applications" 将新路由推送到 Navigator 堆栈时,如何更改 Web 浏览器中的 URL?

例如。 URL 是http://localhost:37291/#/,执行后

Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => const SecondRoute()),
  );

我希望它更改为http://localhost:37291/#/secondRoute

【问题讨论】:

    标签: flutter


    【解决方案1】:

    你应该使用Navigator 2.0

    这是我建议您使用的最佳软件包。它易于学习和管理。查看Go_Router

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-28
      • 2014-01-23
      • 2015-11-15
      • 2017-02-04
      • 2016-01-22
      • 2012-01-23
      • 1970-01-01
      相关资源
      最近更新 更多