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 disposal #19

Open
pulstar opened this issue Nov 24, 2020 · 0 comments
Open

setState() called after disposal #19

pulstar opened this issue Nov 24, 2020 · 0 comments

Comments

@pulstar
Copy link

pulstar commented Nov 24, 2020

Somewhere in the player code there is a setState() being called after dispose().
All setState() in my code are inside of if (this.mounted) {}.
The error below is occurring when I leave the video screen.

E/flutter ( 6730): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: setState() called after dispose(): _StreamBuilderBaseState<dynamic, AsyncSnapshot<dynamic>>#25bd5(lifecycle state: defunct, not mounted)
E/flutter ( 6730): 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 ( 6730): 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 ( 6730): 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 ( 6730): #0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1233:9)
E/flutter ( 6730): #1      State.setState (package:flutter/src/widgets/framework.dart:1268:6)
E/flutter ( 6730): #2      _StreamBuilderBaseState._subscribe.<anonymous closure> (package:flutter/src/widgets/async.dart:146:9)
E/flutter ( 6730): #3      _rootRun (dart:async/zone.dart:1182:47)
E/flutter ( 6730): #4      _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 6730): #5      _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 6730): #6      _DoneStreamSubscription._sendDone (dart:async/stream_impl.dart:811:36)
E/flutter ( 6730): #7      _rootRun (dart:async/zone.dart:1190:13)
E/flutter ( 6730): #8      _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 6730): #9      _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 6730): #10     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter ( 6730): #11     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 6730): #12     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant