Skip to content

Looking up a deactivated widget's ancestor is unsafe. #189

@lvyandev

Description

@lvyandev

版本信息

  • Flutter版本:[v3.22.0]
  • flutter_smart_dialog版本:[v4.9.7]

描述bug/需求

暂未发现如何复现,且出现如下异常后无法显示toast

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 dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
Stack Trace:
#0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure> (package:flutter/src/widgets/framework.dart:4743:9)
#1      Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4757:6)
#2      Element.visitAncestorElements (package:flutter/src/widgets/framework.dart:4869:12)
#3      LookupBoundary.findAncestorStateOfType (package:flutter/src/widgets/lookup_boundary.dart:166:13)
#4      Overlay.maybeOf (package:flutter/src/widgets/overlay.dart:580:26)
#5      Overlay.of (package:flutter/src/widgets/overlay.dart:530:34)
#6      overlay (package:flutter_smart_dialog/src/kit/view_utils.dart:19:55)
#7      CustomToast.showToast.showToast (package:flutter_smart_dialog/src/custom/toast/custom_toast.dart:46:7)
#8      CustomToast.normalToast (package:flutter_smart_dialog/src/custom/toast/custom_toast.dart:128:25)
#9      CustomToast.showToast (package:flutter_smart_dialog/src/custom/toast/custom_toast.dart:78:13)
#10     DialogProxy.showToast (package:flutter_smart_dialog/src/helper/dialog_proxy.dart:325:18)
<asynchronous suspension>

问题demo

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions