Poging GOUD - Vrij
Introduction to Flutter State Management
Circuit Cellar
|April 2025
As Bob continues this article series on Mobile App development from an Embedded System's perspective, he tackles State and State Management in Flutter. As you will see, it is very different from what embedded engineers are used to when we think of state and that misunderstanding can cause no end of trouble if we don't understand it.
Over the years, I found that designing embedded systems using state machines to be a useful and powerful paradigm. There are different methods of implementing a state machine (Complete code for these is found in the Resources for this article): a table of function pointers indexed by the state (see Figure 1 for a code snippet); the “switch-case” method (see Figure 2 for a code snippet); or when using an object oriented language like C++, you can encapsulate each state in a class to represent the state and it's transitions (see Figure 3).
However, my hubris in thinking I was well versed in state machines did not prepare me for understanding state in either React Native or Flutter. As you may remember, I had two major problems with React Native: how it managed concurrency; and how it managed state. No surprise here. The same thing happened with Flutter, so let's start defining terms and see if we can unravel the mystery of states and state management in Flutter.
Everything in Flutter is made up of Widgets. And there are two kinds of Widgets: State less widgets and Widgets that change based on the state of the User Interface (UI). These are called appropriately StatelessWidgets and StatefulWidgets respectively. But wait! What do they mean by state?
REACTIVE/DECLARATIVE VS IMPERATIVE UI
Dit verhaal komt uit de April 2025-editie van Circuit Cellar.
Abonneer u op Magzter GOLD voor toegang tot duizenden zorgvuldig samengestelde premiumverhalen en meer dan 9000 tijdschriften en kranten.
Bent u al abonnee? Aanmelden
MEER VERHALEN VAN Circuit Cellar
Circuit Cellar
A GPS-Disciplined Frequency Counter using the PSoC 5LP
In this month's column, Brian tasks one of his mixed-signal favorite MCUs, the Infineon PSoC 5LP, to build a frequency/ period counter using a GPS satellite module to discipline the project's time base.
16 mins
November 2025
Circuit Cellar
Designing Analog Electronics
Part 1: Error and Uncertainty
23 mins
November 2025
Circuit Cellar
Samtec Launches 800-Position AcceleRate HP High-Performance Array Connectors
Samtec, Inc., a global leader in high-performance interconnect solutions and a service leader in the industry, announces the expansion of its AcceleRate HP product line with the release of 800-position APM6 and APF6 high-performance array connectors available in a low-profile 5mm stack height.
1 min
November 2025
Circuit Cellar
CIA for SBCs (and More)
Securing Embedded Systems from Evolving Threats
14 mins
November 2025
Circuit Cellar
The Future of Embedded Systems and AI: AI in Embedded Systems
Cybersecurity Challenges and Opportunities in a Smarter World
4 mins
November 2025
Circuit Cellar
An ESP32 Dashboard
Monitoring How a Popular Microcontroller Uses Resources
11 mins
November 2025
Circuit Cellar
Vishay Intertechnology Power Metal Strip Resistor Delivers Power to 5 W in Compact 1206 Case Size
Vishay Intertechnology, Inc. introduced a new surfacemount Power Metal Strip current sense resistor that combines a high power rating up to 5W, TCR down to ± 75ppm/°C, and extremely low resistance values down to 0.3mΩ in the compact 1206 case size.
2 mins
November 2025
Circuit Cellar
ROHM Develops New Smart Switches Optimized for Zonal Controllers
ROHM Semiconductor announced the release of six new high-side smart switches (IPDs: Intelligent Power Devices) featuring highly accurate current sensing and low ON resistances ranging from 9mΩ to 180mΩ.
1 min
November 2025
Circuit Cellar
Bourns Expands Semi-Shielded Power Inductor Portfolio with New Series Featuring Higher Maximum Inductance Values
Bourns, Inc., a leading manufacturer and supplier of electronic components for power, protection, and sensing solutions, announced the expansion of its semi-shielded power inductors.
1 min
November 2025
Circuit Cellar
STMicroelectronics' New Automotive Linear Voltage Regulator Preserves Battery Energy in Challenging Conditions
The TL99VR03 300mA low-dropout (LDO) regulator provides resilient and efficient power, with a wide input-voltage range and very low quiescent current consumption, only 3.5µA at no load. The IC has an enable pin for turning the regulator off, which reduces the idle current to 800nA, and integrates soft-start circuitry to limit current during power-up and fault recovery.
1 min
November 2025
Listen
Translate
Change font size
