【发布时间】:2019-04-19 08:19:23
【问题描述】:
我正在尝试按特定顺序删除对话框,但出现以下错误:
E/flutter (14457): [ERROR:flutter/shell/common/shell.cc(188)] Dart Error: Unhandled exception:
E/flutter (14457): Looking up a deactivated widget's ancestor is unsafe.
E/flutter (14457): At this point the state of the widget's element tree is no longer stable. To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling inheritFromWidgetOfExactType() in the widget's didChangeDependencies() method.
这里的顺序:
- 列表项
- 打开确认对话框 1
- 关闭(onPressed)对话框 1
- 打开加载对话框 2。
- 关闭 (Navigator.of(context).pop())
- 打开对话框 3 并显示成功消息。
对话框 1 和 2 都使用 Navigator.of(context).pop() 关闭。
我该如何解决这个问题?
【问题讨论】:
-
您是否在 dialog1 中创建了 dialog2?
-
不。创建一个对话框并一个接一个地关闭它
标签: flutter