显示Flutter导航堆栈 [英] Show Flutter Navigation stack
问题描述
我想查看Flutter中的导航堆栈.是否可以使用Navigator
类来打印导航堆栈和有关Navigator内部内容的其他元信息?
I want to see the navigation stack in Flutter. Is it possible to use the Navigator
class to print the navigation stack and other meta info about what's inside the Navigator?
使用print()
方法打印Navigator
只是将Navigator
作为字符串.
Printing the Navigator
with the print()
method just gives the Navigator
as a string.
预期结果:Navigator : { params...., params.... }
推荐答案
我认为您当前唯一的方法就是覆盖Navigator
类并自己跟踪路由.
I think the only way you could do this currently is to override the Navigator
class and keep track of the Routes yourself.
If you look at the Navigator source code there is a variable called _history
which contains all the navigated routes but there's no way to access it unfortunately.
这篇关于显示Flutter导航堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!