Why No One Can Understand Flutter State

Fred Grott
7 min readDec 16, 2021
Photo by Karsten Winegart on Unsplash

Ready for that venture into the depths of Flutter State Management? The reason why no one can understand Flutter State and State Management is we are all reading without the contextual context of history and other things.

Code for this article is in this repo:

This is going to be a deep dive into Stateless and Stateful Widgets along with the State class as those classes play a central role in state within the flutter framework.

The Flutter Framework

The Flutter framework like some other front-end frameworks ASPNET, the iOS SDK, etc. manage the application state by automating the build of UI components. We as develops do not individually decide everything about the build of a UI widget or even when they are built.

That, basically, is the meaning of the word framework.

To start with the Flutter State Story, we have to begin with some basic OOP.

Mutable Fields

Let’s see a typical dart class:

Notice that we have something that is mutable that we set and then use its getter method to print out the value. The story of state in the Flutter framework spans two distinctly different programming paradigms and how we approach both mutable and immutable and state.

This time around, we will be talking about mutable and the OOP state patterns.

Note that it might be cumbersome to always grab an instance of the class just to get that mutable state, and then we introduce the problem well what instance do we have and what is the observable point of truth if each instance updates state differently.