其他分享
首页 > 其他分享> > Flutter Navigator operation requested with a context that does not include a Navigat

Flutter Navigator operation requested with a context that does not include a Navigat

作者:互联网

如下直接在 MaterialApp 中使用 Navigator 是会报 Navigator operation requested with a context that does not include a Navigat. ...

 

修改为如下所示,将要使用路由的部分嵌套一层即可正常使用。

 

总结:要使用 路由(Navigator),根控件不能直接是 MaterialApp.

解决方法:将 MaterialApp 内容再使用 StatelessWeight 或 StatefulWeight 包裹一层。

标签:requested,MaterialApp,Navigat,does,operation,include,Navigator
来源: https://www.cnblogs.com/wf-l5201314/p/10431152.html