Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何删除颤振中的特定路径?_Flutter_Navigator - Fatal编程技术网

Flutter 如何删除颤振中的特定路径?

Flutter 如何删除颤振中的特定路径?,flutter,navigator,Flutter,Navigator,我想从导航堆栈中获取一个特定的命名路由,并使用Navigator.removoute(context,route)将其删除;但是我怎样才能得到路线呢?这是有效的 Navigator.removeRoute(context, MaterialPageRoute(builder: (context) => ThePage())); 您必须指定要删除的路线,而不是名称 示例 输出: 这很有效 Navigator.removeRoute(context, MaterialPageRoute(bu

我想从导航堆栈中获取一个特定的命名路由,并使用Navigator.removoute(context,route)将其删除;但是我怎样才能得到路线呢?

这是有效的

Navigator.removeRoute(context, MaterialPageRoute(builder: (context) => ThePage()));
您必须指定要删除的
路线
,而不是名称

示例

输出:

这很有效

Navigator.removeRoute(context, MaterialPageRoute(builder: (context) => ThePage()));
您必须指定要删除的
路线
,而不是名称

示例

输出:


欢迎来到堆栈溢出。请举例说明你想要什么。欢迎使用堆栈溢出。你能举个例子更具体一点吗,你想要什么。不起作用。获取此错误:失败的断言:第2185行位置12:“route.\u navigator==this”:不正确。如果你做过类似的事情,你能和大家分享一个例子吗?你使用MaterialPage路线导航了吗?是的。我使用的材料不起作用。获取此错误:失败的断言:第2185行位置12:“route.\u navigator==this”:不正确。如果你做过类似的事情,你能和大家分享一个例子吗?你使用MaterialPage路线导航了吗?是的。我使用了MaterialPageRoute