Why the hell setState() sometimes does not work?

How to force a Widget to redraw in Flutter?

…and why Flutter tries to recycle Widgets’s State?

Jelena Lecic
4 min readAug 11, 2020

--

How many times have you called setState() and nothing on the screen has changed even though the internal State of the Widget has changed?
I know I have, many times :)

So, simple screen with a Text that displays current value that gets incremented each time user presses the button. This would be a no brainer if we were using a stateless Text Widget -> it would be rebuilt each time user clicks the button.

But, our implementation of the Text looks like this:

--

--