State Management
State management is a crucial concept focused on maintaining and controlling the state of an application. Simply put, it involves monitoring the changes within your app and updating the user interface to reflect these changes.
The UI (user interface) displays information based on state variables. When these state variables change, the UI updates to reflect the changes.
State Variables
In FlutterFlow, there are a few types of state variables that you can create:
- State variables are themselves variables - meaning they have a name and a data type.
- They also have an initial value that is set when you create the variable.
- Once you create a state variable, it's value can be used to change the configuration of widget properties - like any other variable.
- You can update the value of state variables using the Update State Variable action.
Creating State Variables
- To create an App State variable, refer to this guide.
- To create a Page State variable, refer to this guide.
- To create a Component State variable, refer to this guide.
Note: Users cannot create widget state variables. These are automatically exposed by FlutterFlow when a Form widget is used.
Updating State Variables
- To update an App State variable, refer to this guide.
- Refer to the Page Lifecycle guide to learn about updating Page State variables.
- Refer to the Component Lifecycle guide to learn about updating Component State variables.
Learn from video
You can learn more about state management from this video: