See the stack of Flutter Navigator

后端 未结 1 1480
情书的邮戳
情书的邮戳 2020-12-11 14:43

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

I am using Visual Studio Code and Android Studio.

For instance:

相关标签:
1条回答
  • 2020-12-11 15:31

    Following steps:

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

    2. Run your app to the break point

    3. Open "Evaluate expression"

    4. Evaluate Navigator.of(context)

    5. Inspect the _history

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

    Hope it helps

    0 讨论(0)
提交回复
热议问题