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/ff-concepts/adding-customization/code-file.md
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,15 +139,16 @@ You need to create an instance of a class so you can work with actual data and u
139
139
);
140
140
```
141
141
142
-
- You can reuse the same classstructure multiple times with different review data.
142
+
- In FlutterFlow, you will store the instance of the custom classin the [state variables](../../ff-concepts/state-management/state-variables.md#state-variables) of your app, page, or component.
143
+
- You can create multiple instances of the same class, reusing the same structure multiple times, each with different review data.
143
144
144
145
When you create an instance of a class, you can:
145
146
146
147
- Store actual review details.
147
148
- Access and update the fields (e.g., `review1.rating` or `review1.comment`).
148
149
- Call methods that do something with that data (e.g., `review1.markHelpful()` or `review1.shortComment()`).
149
150
150
-
To create an instance of a custom class, open the **Set from Variable** dialog and select **Create Custom Class Instance**. Choose the classyou want to use, then select the classname from the **Constructor**dropdown. After that, set values for each of the required fields.
151
+
To create an instance of a custom class, first you need to [create a state variable](../../ff-concepts/state-management/state-variables.md#creating-state-variables) (of type Custom Class) that will hold the instance. Then, to create and add the instance to the state variable, open the **Set from Variable** dialog and select **Create Custom Class Instance**. Choose the classyou want to use, then select the classname from the **Constructor**dropdown. After that, set values for each of the required fields.
151
152
152
153
153
154
<div style={{
@@ -412,7 +413,15 @@ Use the **Call Static Method** action to run a static method of your class. For
412
413
413
414
Similar to how you add a custom class, you can also add Custom Enums in your app. [Enums](../../resources/data-representation/enums.md) are a great way to define a fixed set of values, such as user roles, order statuses, or content types. Once parsed, these enums become available throughout your app and can be used in dropdowns, conditionals, and UI bindings.
414
415
415
-
For example, you could define an enum called `ReviewStatus` with values like `pending`, `approved`, and `rejected`.
416
+
For example, you could define an enum called `ReviewStatus` with values like `pending`, `approved`, and `rejected`. Here's the code snippet for it:
0 commit comments