From 104907f3d02e674c1ef78585dfe948b972b0cdf0 Mon Sep 17 00:00:00 2001 From: Tirth Patel Date: Sun, 18 May 2025 15:18:05 +0530 Subject: [PATCH] Update ff-app-state.md --- docs/generated-code/ff-app-state.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/generated-code/ff-app-state.md b/docs/generated-code/ff-app-state.md index 44eb9ff5..ab792043 100644 --- a/docs/generated-code/ff-app-state.md +++ b/docs/generated-code/ff-app-state.md @@ -34,15 +34,14 @@ class FFAppState extends ChangeNotifier { notifyListeners(); } - // App State variable of primitive type with a getter and setter - bool _enableDarkMode = false; + // App State variable of primitive type with a getter and setter + bool _enableDarkMode = false; - bool get enableDarkMode => _enableDarkMode; + bool get enableDarkMode => _enableDarkMode; - set enableDarkMode(bool value) { + set enableDarkMode(bool value) { _enableDarkMode = value; - } - + } } ``` @@ -52,7 +51,7 @@ The `_enableDarkMode` is an App State variable created by developer that creates 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. ### Rebuild Current Page -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. +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. Here's an example of the generated code when we update the App State `enableDarkMode` in the `onInitialization` action trigger of the `ProductListPage`. @@ -90,7 +89,7 @@ Only the setter is called with no setState or update method invoked afterward. T 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: ```js - @override +@override Widget build(BuildContext context) { context.watch(); ... @@ -155,4 +154,4 @@ These functions are automatically generated to provide a convenient and consiste :::info[How to create App State variables] 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. -::: \ No newline at end of file +:::