fix: CircularDataLabelRendererState setState() called after dispose() #1311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
exception was thrown: setState() called after dispose(): CircularDataLabelRendererState#5db96(lifecycle state: defunct, not mounted, ticker inactive)
`
I/flutter (13276): ══╡ EXCEPTION CAUGHT BY ANIMATION LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (13276): The following assertion was thrown while notifying status listeners for AnimationController:
I/flutter (13276): setState() called after dispose(): CircularDataLabelRendererState#c3fe4(lifecycle state: defunct,
I/flutter (13276): not mounted, ticker inactive)
I/flutter (13276): This error happens if you call setState() on a State object for a widget that no longer appears in
I/flutter (13276): the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
I/flutter (13276): can occur when code calls setState() from a timer or an animation callback.
I/flutter (13276): The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
I/flutter (13276): callback. Another solution is to check the "mounted" property of this object before calling
I/flutter (13276): setState() to ensure the object is still in the tree.
I/flutter (13276): This error might indicate a memory leak if setState() is being called because another object is
I/flutter (13276): retaining a reference to this State object after it has been removed from the tree. To avoid memory
I/flutter (13276): leaks, consider breaking the reference to this object during dispose().
I/flutter (13276):
I/flutter (13276): When the exception was thrown, this was the stack:
I/flutter (13276): #0 State.setState.framework.dart:1103
I/flutter (13276): #1 State.setState framework.dart:1138
I/flutter (13276): #2 CircularDataLabelRendererState.render data_label_renderer.dart:107
I/flutter (13276): #3 CircularArea._bindSeriesWidgets. circular_area.dart:697
I/flutter (13276): #4 AnimationLocalStatusListenersMixin.notifyStatusListeners listener_helpers.dart:240
I/flutter (13276): #5 AnimationController._checkStatusChanged animation_controller.dart:815
I/flutter (13276): #6 AnimationController._tick animation_controller.dart:831
I/flutter (13276): #7 Ticker._tick ticker.dart:249
I/flutter (13276): #8 SchedulerBinding._invokeFrameCallback binding.dart:1284
I/flutter (13276): #9 SchedulerBinding.handleBeginFrame. binding.dart:1136
I/flutter (13276): #10 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
I/flutter (13276): #11 SchedulerBinding.handleBeginFrame binding.dart:1134
I/flutter (13276): #12 SchedulerBinding._handleBeginFrame binding.dart:1051
I/flutter (13276): #13 _invoke1 (dart:ui/hooks.dart:158:13)
I/flutter (13276): #14 PlatformDispatcher._beginFrame (dart:ui/platform_dispatcher.dart:337:5)
I/flutter (13276): #15 _beginFrame (dart:ui/hooks.dart:101:31)
I/flutter (13276):
I/flutter (13276): The AnimationController notifying status listeners was:
I/flutter (13276): AnimationController#b05dd(⏭ 1.000; paused)
I/flutter (13276): ═══════════════════════════════════════════════════════════════════════════════
`