Stateful vs Stateless Widget Explained For Dummies

Isheunesu Tembo
2 min readFeb 5, 2023

--

First let’s talk about water and a rock , before we move into stateful vs stateless widgets . Water has three states which are ice , liquid and vapour and it changes into these states when it is exposed to different conditions , for example if we heat ice at 100 degrees celsius it turns into liquid and then vapour when further heated . The opposite is true for a rock if we heat it at 100 degrees or cool it at 0 degrees celcius it remains a rock.

Let’s rewind a bit , we forgot to define what’s a state , so a state is any value that can change. So in our example the water’s state changes form ice , to liquid to vapour or vice versa , so we can easily say that water is a stateful widget since it’s state changes and a rock is a stateless widget since it’s state does not change.

So going back to stateful and stateless widget , we can say that a stateful widget is a widget with a state that can change and a stateless widget is a widget is a widget with a value that does not change. So a stateful widget is water (it’s state can change) , where a stateless widget is a rock (it’s state does not change)

That’s it from me you can watch my video on stateful vs stateless widget.

https://www.youtube.com/watch?v=jXKg3g2AOJ4

--

--

Isheunesu Tembo
Isheunesu Tembo

No responses yet