'/'在应用程序启动时,路线会不断自动推送到导航器。
让我们从官方文档的这个例子开始。
一切正常,但如果您更改'/'为'/home'(同时更改为initiaRoute和routes),我们会收到以下错误:
The requested route name was: "/home"
The following routes were therefore attempted:
* /
* /home
This resulted in the following objects:
* null
* MaterialPageRoute<dynamic>(RouteSettings("/home", null), animation: null)
One or more of those objects was null, and therefore the initial route specified will be ignored and
"/" will be used instead.
Run Code Online (Sandbox Code Playgroud)
问题1:我明确定义'/home'为initialRoute,为什么坚持要去'/'?
我试图通过为'/'.
错误已“修复”,应用程序在正确的页面上启动,但小部件树看起来像这样:

Container 是我创建的“空白页面”,'/'并且仍在被推送。更令人困惑的是,它位于导航堆栈的顶部! …
flutter ×1