Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setState() called after dispose() #708

Open
1 task done
LookForward1 opened this issue Jan 10, 2025 · 0 comments
Open
1 task done

setState() called after dispose() #708

LookForward1 opened this issue Jan 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@LookForward1
Copy link

Affected version

0.16.2

Flutter versions

3.24.4

No same issues found.

  • Yes, I search all issues but not found.

Steps to Reproduce

  1. webf自定义列表元素
  2. 在vue中使用该元素,
  3. 出现错误: Unhandled Exception: setState() called after dispose(): HTMLElementState#4a7e5(lifecycle state: defunct, not mounted)

Code example

none

Expected results

none

Actual results

E/flutter ( 7720): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: setState() called after dispose(): HTMLElementState#4a7e5(lifecycle state: defunct, not mounted)
E/flutter ( 7720): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
E/flutter ( 7720): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
E/flutter ( 7720): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
E/flutter ( 7720): #0 State.setState. (package:flutter/src/widgets/framework.dart:1167:9)
E/flutter ( 7720): #1 State.setState (package:flutter/src/widgets/framework.dart:1202:6)
E/flutter ( 7720): #2 HTMLElementState.addWidgetChild. (package:webf/src/widget/element_to_widget_adapter.dart:37:7)
E/flutter ( 7720): #3 new Future.microtask. (dart:async/future.dart:285:40)
E/flutter ( 7720): #4 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter ( 7720): #5 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter ( 7720):

@LookForward1 LookForward1 added the bug Something isn't working label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant