Unhandled Exception: setState() called after dispose():

1,955 views
Skip to first unread message

Dev Connect

unread,
Jun 24, 2020, 8:10:35 AM6/24/20
to Flutter Development (flutter-dev)
Hello  code below flutter deals with the management of a bottombar when the code is executed, click on the Icons.add button and then change bottom element the system displays this error,
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: setState() called after dispose(): _HomeViewScreenState#d0762(lifecycle state: defunct, tickers: tracking 1 ticker) 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. 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().




Flutter Code HomeState: https://pastebin.com/W3d8P5Vg

Ralph Bergmann

unread,
Jun 24, 2020, 8:14:45 AM6/24/20
to Dev Connect, Flutter Development (flutter-dev)
--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/97a2a182-993d-4fc0-8d6a-6b7ad851293do%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages