You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/generated-code/ff-app-state.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,15 +34,14 @@ class FFAppState extends ChangeNotifier {
34
34
notifyListeners();
35
35
}
36
36
37
-
// App State variable of primitive type with a getter and setter
38
-
bool _enableDarkMode =false;
37
+
// App State variable of primitive type with a getter and setter
38
+
bool _enableDarkMode =false;
39
39
40
-
bool get enableDarkMode=> _enableDarkMode;
40
+
bool get enableDarkMode=> _enableDarkMode;
41
41
42
-
setenableDarkMode(boolvalue) {
42
+
setenableDarkMode(boolvalue) {
43
43
_enableDarkMode = value;
44
-
}
45
-
44
+
}
46
45
}
47
46
```
48
47
@@ -52,7 +51,7 @@ The `_enableDarkMode` is an App State variable created by developer that creates
52
51
When updating an `AppState` variable from the Action Flow Editor, you will be presented with several **[update type](../resources/data-representation/app-state.md#update-type)** options such as **Rebuild All Pages**, **Rebuild Current Page**, and **No Rebuild** in the Action Settings. Let's see how the generated code changes when these options are selected.
53
52
54
53
### Rebuild Current Page
55
-
When a developer chooses to update App State with the update type set to **Rebuild Current Page**, the corresponding `setter` is called. Immediately after, `setState((){});` is invoked, which updates only the current page.
54
+
When a developer chooses to update App State with the update type set to **Rebuild Current Page**, the corresponding `setter` is called. Immediately after, `setState((){});` is invoked, which updates only the current page.
56
55
57
56
Here's an example of the generated code when we update the App State `enableDarkMode` in the `onInitialization` action trigger of the `ProductListPage`.
58
57
@@ -90,7 +89,7 @@ Only the setter is called with no setState or update method invoked afterward. T
90
89
When you add an [**Update App State**](../resources/data-representation/app-state.md#update-app-state-action) action via the Action Flow Editor, the corresponding pages will include this line within the build method:
91
90
92
91
```js
93
-
@override
92
+
@override
94
93
Widget build(BuildContextcontext) {
95
94
context.watch<FFAppState>();
96
95
...
@@ -155,4 +154,4 @@ These functions are automatically generated to provide a convenient and consiste
155
154
156
155
:::info[How to create App State variables]
157
156
To learn more about creating and using App State variables in FlutterFlow's UI, check out the[ **App State**](../resources/data-representation/app-state.md) guide.
0 commit comments