title: call setState() on a State object for a widget
body: <p>The code below flutter deals with the management of a bottombar when the code is executed, click on the <code>Icons.add</code> button and then change bottom element the system displays following error:</p>
  <p><strong>Error:</strong></p>
  <blockquote>
  <p>[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: setState() called after dispose(): _HomeViewScreenState#d0762(lifecycle state: defunct, tickers: tracking 1 ticker)</p>
  </blockquote>
  <p>This error happens if you call <code>setState()</code> 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 <code>setState()</code> from a timer or an animation callback.</p>
  <p>The preferred solution is to cancel the timer or stop listening to the animation in the <code>dispose()</code> callback. Another solution is to check the &quot;mounted&quot; property of this object before calling <code>setState()</code> to ensure the object is still in the tree.</p>
  <p>This error might indicate a memory leak if <code>setState()</code> 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 <code>dispose()</code>.</p>
  <p><a href="https://pastebin.com/Birv1fkc" rel="nofollow noreferrer"><strong>Flutter Code</strong></a></p>
  <p><a href="https://pastebin.com/W3d8P5Vg" rel="nofollow noreferrer"><strong>Flutter Code HomeState</strong></a></p>