DEV Community

Cover image for Stateless and Stateful widgets 👩_💻👨_💻
Lahiru Udawaththa
Lahiru Udawaththa

Posted on

Stateless and Stateful widgets 👩_💻👨_💻

Alt Text

In flutter programming there two kind of widgets.
*STATELESS
*STATEFUL

But before we get into what Stateless and Stateful, we need to understand what is the State of this.
The simplest way to put it, State is something that can change within a widget.

Stateless widgets- This widgets never changes.
"Icons,Buttons,Icon button,Colors and text" are examples for stateless widget...

Stateful widgets- Dynamic,This widget can be change,Its appearance in response to event trigger by user interactions.
when STF(stateful widget) receives data.
Checkbox,Radio,Slider,Form,Text Field are some examples for STF(stateful widget).

Alt Text

Follow this 4 step and create Stateful widgets.

Alt Text

Step 1: Decide which object manages the widget’s state
Step 2: Subclass Stateful Widget
Step 3: Subclass State
Step 4: Plug the stateful widget into the widget tree

More Detail visite.:-https://flutter.dev/docs/development/ui/interactive

Top comments (0)