fluttercommunity / flutter_sticky_headers

Flutter Sticky Headers - Lets you place "sticky headers" into any scrollable content in your Flutter app. No special wrappers or magic required. Maintainer: @slightfoot
https://pub.dev/packages/sticky_headers
MIT License
1.1k stars 129 forks source link

Unhandled exception: setState() called after dispose() #6

Closed marcglasberg closed 5 years ago

marcglasberg commented 6 years ago

Simon, I get this if I scroll the list fast enough:

Unhandled exception:
E/flutter ( 4840): setState() called after dispose(): _StickyHeaderBuilderState#2ad9c(lifecycle state: defunct, not mounted)
_StickyHeaderBuilderState.build.<anonymous closure>.<anonymous closure> (package:sticky_headers/sticky_headers/widget.dart:121:58)

It tells me this:

*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. 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 ( 4840): 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().*

I believe the item is being removed from the tree (because of scrolling) before the next frame is displayed.

filly82 commented 5 years ago

got the same error. did you solve your problem @marcglasberg ?

marcglasberg commented 5 years ago

No, I didn't.

ldsenow commented 5 years ago

I have the same error and it looks like no one is maintaining the project atm.

slightfoot commented 5 years ago

This is resolved as of v0.1.8