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 包裹一层。
Flutter Navigator operation requested with a context that does not include a Navigat的更多相关文章
- flutter dialog异常Another exception was thrown: Navigator operation requested with a context that does not include a Navigator
我在使用flutter里的对话框控件的时候遇到了一个奇怪的错误 Another exception was thrown: Navigator operation requested with a c ...
- flutter: Another exception was thrown: Navigator operation requested with a context that does not include a Navigator.
import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends State ...
- System.TimeoutException: The operation requested on PersistentChannel timed out
这个异常是在使用EasyNetQ时,遇到的问题,找了两个小时. 详细错误 Error:System.TimeoutException: The operation requested on Persi ...
- ABP .Net Core 调用异步方法抛异常A second operation started on this context before a previous asynchronous operation completed
1. 问题描述 最近使用ABP .Net Core框架做一个微信开发,同时采用了一个微信开发框架集成到ABP,在微信用户关注的推送事件里调用了一个async 方法,由于没有返回值,也没做任何处理,本 ...
- Flutter Navigator&Router(导航与路由)
参考地址:https://www.jianshu.com/p/b9d6ec92926f 在我们Flutter中,页面之间的跳转与数据传递使用的是Navigator.push和Navigator.pop ...
- Flutter Navigator 跳转
1,routes 静注册,使用 跳转 Navigator.pushNamed(context, "/main"); 2,静态跳转及销毁当前页面使用 Navigator.pushNa ...
- flutter Failed to setup Skia Gr context导致白屏
添加 --enable-software-rendering参数运行 G:\soft\flutter\project\hello_world> flutter run --enable-soft ...
- Entity Framework Core: A second operation started on this context before a previous operation completed
我这边报错是因为函数声明的是async void 而实现中有多个task任务,导致的线程不安全
- 【Flutter学习】一些重要的概念之of(context)方法
在flutter中我们经常会使用到这样的代码 //打开一个新的页面 Navigator.of(context).push //打开Scaffold的Drawer Scaffold.of(context ...
随机推荐
- win10 家庭版使用注册表关闭windows defender
管理员身份运行 reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v " ...
- 【转载】Mysql中的Btree与Hash索引比较
转载地址:http://www.jb51.net/article/62533.htm 这篇文章主要介绍了Mysql中的Btree与Hash索引比较,本文起讲解了B-Tree 索引特征.Hash 索引特 ...
- PrintWriter类
PrintWriter是一种过滤流,也是一种处理流,即能对字节流和字符流进行处理. 1.查询API后,我们发现,会有八种构造方法.即: PrintWriter(File file) Creates a ...
- unittest测试框架详谈及实操(三)
断言 unittest的TestCase类提供了很多实用的方法来校验预期结果和程序返回的实际结果是否一致.当然这些方法要求必须满足某些条件才能继续执行接下的测试.大致有3种这样的方法.各覆盖一个特定类 ...
- SQL server 累加求和
1. SELECT SalesOrderID, ProductID, OrderQty ,SUM(OrderQty) OVER(PARTITION BY SalesOrderID) AS Tot ...
- numpy.convolve()
卷积函数: numpy.convolve(a, v, mode='full') Parameters: a : (N,) array_like First one-dimensional input ...
- Altera SOPC FrameBuffer系统设计教程
Altera SOPC FrameBuffer系统设计教程 小梅哥编写,未经授权,严禁转载或用于任何商业用途 在嵌入式系统中,LCD屏作为最友好的人机交互方式,被大量的应用到了各个系统中.在基于ARM ...
- Solr: a custom Search RequestHandler
As you know, I've been playing with Solr lately, trying to see how feasible it would be to customize ...
- Partition--分区Demo
--============================================================= --创建分区函数 --创建500分区,分区键按照1000依次递增 CRE ...
- VS 发布MVC网站缺少视图解决方案
VS 发布MVC网站缺少视图解决方案 mvc项目发布之后会有一些视图文件缺少,不包含在发布文件中,虽然可以直接从项目文件中直接拷贝过来,但还是想知道是什么原因,发布文件好像没有找到哪里有设置这个的地 ...