I am using flutter_bloc to implement bloc in my app.
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.
How do I maintain state in my widget in between these transitions ?
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.
I have a StatefulWidget with state which looks like this -
List<String> allTexts = List();
but updating this state is not working as calling setState throws this error -
setState() or markNeedsBuild() called during build.
How do I solve this problem ?
Thanks in advance.