Skip to main content

Command Palette

Search for a command to run...

Stateful vs Stateless Widgets in Flutter

Published
•1 min read•View as Markdown
I

I am an 18 year old developer, I'm interested in all things tech. I mostly use Python, C, and JavaScript, but I dabble in a little of everything. I'm very passionate about open source software, fitness, and Linux.

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

More from this blog

CobbCoding's Tech Adventures

10 posts

I'm an 18 year old student, looking to learn as much as possible about all things tech. My main interests are in software, but I dabble in the hardware world as well.

I use arch btw