查看Flutter Navigator的堆栈 [英] See the stack of Flutter Navigator

查看:664
本文介绍了查看Flutter Navigator的堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行过程中,开发人员是否可以查看Navigator堆栈的状态?

During execution, is there a way for the developer to see the state of the Navigator stack?

我正在使用Visual Studio Code和Android Studio.

I am using Visual Studio Code and Android Studio.

例如:

Navigator 
RouteA
RouteB
RouteD
etc. 

推荐答案

以下步骤:

  1. 设置要检查的断点,该断点必须在具有contextbuilder函数内部,并在Debug模式下运行

  1. Set a breakpoint where you want to inspect, which must be inside a builder function which has context, and run in Debug mode

将应用程序运行到断点

打开求值表达式"

评估Navigator.of(context)

检查_history

在我的示例中,您可以看到历史记录中有2条路由,以及所有相关的可调试数据.

In my example, you can see there are 2 routes in the history, with all relevant debuggable data.

希望有帮助

这篇关于查看Flutter Navigator的堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆