【问题标题】:How to print the current route path in flutter using auto_router?如何使用 auto_router 在 Flutter 中打印当前路由路径?
【发布时间】:2021-12-29 02:48:15
【问题描述】:

我一直在我的颤振应用程序中使用auto_route 进行导航。我想知道是否有任何方法可以打印当前路由路径(例如:/home/profile ...)。对调试和管理路由有很大帮助。

有什么办法吗?

【问题讨论】:

    标签: flutter flutter-navigation


    【解决方案1】:

    通过下面的行你可以得到当前路线:

     ModalRoute.of(context).settings.name
    

    【讨论】:

      猜你喜欢
      • 2018-03-11
      • 2013-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-15
      • 1970-01-01
      • 2020-02-11
      相关资源
      最近更新 更多