Stateless and Stateful Widgets


What is State?

Go through this video to get a rough idea about stateless and stateful widgets.

As time progresses, you will get a hang of them.

https://www.youtube.com/watch?v=QlwiL_yLh6E&ab_channel=Flutter

Stateless vs Stateful widgets

State is information that-

(1) can be read when the widget is built and

(2) might change during the lifetime of the widget.

A Stateful Widget has its own mutable state that it needs to track. It is modified according to the user's input.

Watch this video to know about Stateless widgets.

https://www.youtube.com/watch?v=wE7khGHVkYY&ab_channel=GoogleforDevelopers

Now that you have learned about stateless widgets, we must make our app interactive.

We want our app to respond to taps, long presses, etc. But widgets are immutable i.e., all the properties of a widget are final. Thus, to make our widget interactive, we need to use Stateful widgets. Watch the following video to learn how to use stateful widgets in your app.

https://www.youtube.com/watch?v=AqCMFXEmf3w&ab_channel=GoogleforDevelopers

You may additionally go through this article to gain more insights.

Flutter - Stateful vs Stateless Widgets - GeeksforGeeks

Demonstration


Here is a video demonstrating the difference between stateless and stateful widgets:

https://www.youtube.com/watch?v=HsVUC6CcOqY&t=183s&ab_channel=LearnFlutterwithMe