Stateful vs Stateless Widgets in Flutter

As I continue to learn Flutter to develop my app, one of the first questions that came up is the difference between a stateful widget and a stateless widget. In this article, I'm going to look at both widgets and briefly explain some of the differences between the two.

What is the state

The first question that needs to be answered is what the "state" even is. To put it simply, the state is the information on the screen, which may need to be updated as the app is running. For example, if you place a Text widget on the screen, and you want the value to start as something like "First." Then, you decide to, on the press of a button, change the text to "Second."

Stateful vs Stateless

So, as you probably can guess now knowing the definition, a stateful widget is a widget that has the state, whereas a stateless widget does not. This means that inside a stateful widget, you can set the current state, which then updates the state during runtime. Obviously, this is used in nearly every application and is something you need to know when working with Flutter.

That's all for this article, if you want to see how the development of the app is coming along, check it out on GitHub: https://github.com/CobbCoding1/tracking_progression