title: Flutter : Saving state in a widget between Bloc transitions
body: <p>I am using <code>flutter_bloc</code> to implement bloc in my app. </p>
  
  <p>I have a screen which does multiple transitions. So multiple events are dispatched on different actions on the page and each state returned represents the state in return for that specific event. </p>
  
  <p>How do I maintain state in my widget in between these transitions ?</p>
  
  <p>For example, the screen has 3 buttons. Each button click dispatches an event and the state returns a piece of text. So after clicking button1, the state returns a State object with the text and the button is replaced by this text. Now when the user clicks button2, it returns another piece of text and it replaces button2. But when this happens, button1's text disappears. </p>
  
  <p>I have a StatefulWidget with state which looks like this - </p>
  
  <pre><code>List&lt;String&gt; allTexts = List();
  </code></pre>
  
  <p>but updating this state is not working as calling setState throws this error - </p>
  
  <pre><code>setState() or markNeedsBuild() called during build.
  </code></pre>
  
  <p>How do I solve this problem ?</p>
  
  <p>Thanks in advance. </p>