Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
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.
You’re trying to access a context that isn’t probably available.
参考:
https://stackoverflow.com/questions/54617432/looking-up-a-deactivated-widgets-ancestor-is-unsafe
context不可用了,但是任然想使用,就会报这个错,mark!

本文探讨了在Flutter中遇到的UnhandledException错误:查找已停用小部件的祖先存在风险。该问题通常发生在尝试访问不可用的上下文时,并提供了解决方案,建议在小部件的dispose方法中安全地引用其祖先。
1521

被折叠的 条评论
为什么被折叠?



