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
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ FlutterFlow allows you to add your own custom Dart files with [classes](https://
29
29
30
30
To add a custom class, go to the **Custom Code** from the left navigation menu, click **plus (+)** button, and select **Code File**. Set the name of the file, add your code, and hit the **Save** button. Now, you must **validate** your code in the editor to catch basic syntax errors. If there are no errors, click the **Parse** button. FlutterFlow will scan your code and automatically detect supported classes and enums.
31
31
32
-
Here’s an example of adding a Review custom class:
32
+
Here’s an example of adding a `Review` custom class:
33
33
34
34
<div style={{
35
35
position: 'relative',
@@ -57,7 +57,7 @@ Here’s an example of adding a Review custom class:
57
57
</div>
58
58
<p></p>
59
59
60
-
Here's the code snippet of the Review custom class:
60
+
Here's the code snippet of the `Review` custom class:
61
61
62
62
```jsx
63
63
classReview {
@@ -114,6 +114,9 @@ class Review {
114
114
}
115
115
}
116
116
```
117
+
:::tip
118
+
You can also include import statements and access generated classes within your custom class files. For more details, [**see the examples**](common-examples.md) on how to access generated classes.
119
+
:::
117
120
118
121
## Create Custom Class Instance
119
122
@@ -173,7 +176,7 @@ To create an instance of a custom class, open the **Set from Variable** dialog a
173
176
</div>
174
177
<p></p>
175
178
176
-
:::tip[When You Don't Need an Instance]
179
+
<!--:::tip[When You Don't Need an Instance]
177
180
178
181
You can skip instance creation when everything in the class is `static`, meaning it's shared across all uses (like a utility class). For example, look at the classbelow:
179
182
@@ -186,7 +189,7 @@ class Utils {
186
189
In such cases, you can directly access the classdata and methods via the **Set from Variable** menu.
@@ -208,7 +211,7 @@ You can use custom class fields to display values directly in the UI, and call i
208
211
209
212
You can also add your custom class’s methods directly within an Action Flow. For example, you can trigger the `markHelpful()` method when a user taps a “Mark as Helpful” button to update a field or increment the helpful count of a review.
210
213
211
-
## Enums
214
+
## Custom Enums
212
215
213
216
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.
0 commit comments