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/resources/control-flow/functions/utility-functions.md
+18-14Lines changed: 18 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,7 +101,7 @@ To add inline function, open the Set from Variable dialog wherever it's possible
101
101
For example, we may want to quickly calculate the discount amount of a product where the discount is 18% of the MRP of the product. The expression would be `cost - (cost * discount)`.
102
102
103
103
:::tip
104
-
Looking for more power and flexibility? Use the new [**Custom Code Expression**](#code-expression). It’s a more advanced version of Inline Functions that lets you access FlutterFlow generated resources without passing them as arguments. You also get real-time autocomplete and inline error checking for faster, more accurate logic.
104
+
Looking for more power and flexibility? Use the new [**Custom Code Expression**](#custom-code-expression). It’s a more advanced version of Inline Functions that lets you access FlutterFlow generated resources without passing them as arguments. You also get real-time autocomplete and inline error checking for faster, more accurate logic.
105
105
:::
106
106
107
107
**Precedence of operations**
@@ -166,23 +166,27 @@ Here are some common expressions you can use for your business logic:
166
166
|`int.parse(s)`| Convert the **String** into an **integer.**|`int.parse(stringValue)`|`int`|
167
167
168
168
169
-
## Code Expression
169
+
## Custom Code Expression
170
170
171
-
**Code Expression** lets you write short Dart code directly in widget property fields and action flows in FlutterFlow. It’s a more powerful version of [**Inline Function**](#inline-function-code-expressions), allowing you to directly access FlutterFlow generated classes, global variables, widget properties, parameters, and more without needing to manually pass them as inputs.
171
+
**Custom Code Expression** lets you write short Dart code directly in widget property fields and action flows in FlutterFlow. It’s a more powerful version of [**Inline Function**](#inline-function-code-expressions), allowing you to directly access FlutterFlow generated classes, global variables, widget properties, parameters, and more without needing to manually pass them as inputs.
172
172
173
-
Code Expressions also support real-time autocomplete, making it easy to discover available fields as you type. For example, when you type `FFAppState().`, it will suggest all available app state variables along with their types.
173
+
Custom Code Expressions also support real-time autocomplete, making it easy to discover available fields as you type. For example, when you type `FFAppState().`, it will suggest all available app state variables along with their types.
174
174
175
175
In addition, inline validation provides immediate feedback as you write, helping you catch syntax errors or invalid property references.
176
176
177
+
:::info
178
+
To use Custom Code Expression, you must have an active [**FlutterFlow paid plan**](https://www.flutterflow.io/pricing).
179
+
:::
180
+
177
181
:::tip
178
-
- To explore what you can access within a code expression, refer to the [**Common Examples**](../../../ff-concepts/adding-customization/common-examples.md) page.
179
-
- Press `^ + Space` (or `Ctrl + Space`) while typing to see suggestions for what you can access in your code expression.
182
+
- To explore what you can access within a Custom code expression, refer to the [**Common Examples**](../../../ff-concepts/adding-customization/common-examples.md) page.
183
+
- Press `^ + Space` (or `Ctrl + Space`) while typing to see suggestions for what you can access in your Custom code expression.
180
184
- You can access values inside custom structs. For example, you can use `FFAppState().localDeviceInfo.osVersion` if that field exists in your app state.
181
-
- To use code expressions better, it's helpful to understand how FlutterFlow builds your project behind the scenes. You can check the [**State Management**](../../../generated-code/state-mgmt-gen-code.md) page and other **Generated Code** sections to learn how everything is set up.
185
+
- To use Custom code expressions better, it's helpful to understand how FlutterFlow builds your project behind the scenes. You can check the [**State Management**](../../../generated-code/state-mgmt-gen-code.md) page and other **Generated Code** sections to learn how everything is set up.
182
186
183
187
:::
184
188
185
-
Here are a couple of examples showing how to access App State and Page State within a code expression:
189
+
Here are a couple of examples showing how to access App State and Page State within a Custom code expression:
186
190
187
191
-**App State Access:** For example, to check if dark mode is enabled using an App State variable:
188
192
@@ -200,7 +204,7 @@ Here are a couple of examples showing how to access App State and Page State wit
200
204
201
205
This expression checks if the `searchText`variable (defined as a page state) is empty, and returns an appropriate message. The`_model` object refers to the current page’s generated state model.
202
206
203
-
Here's an example of adding a Code Expression:
207
+
Here's an example of adding a Custom Code Expression:
204
208
205
209
<div style={{
206
210
position: 'relative',
@@ -230,7 +234,7 @@ Here's an example of adding a Code Expression:
230
234
231
235
### Execute Custom Code [Action]
232
236
233
-
To use a Code Expression when triggering actions in FlutterFlow (i.e., inside an Action Flow), you can use the **Execute Custom Code** action. This allows you to run a Dart expression when something happens, such as tapping a button or after a page loads.
237
+
To use a Custom Code Expression when triggering actions in FlutterFlow (i.e., inside an Action Flow), you can use the **Execute Custom Code** action. This allows you to run a Dart expression when something happens, such as tapping a button or after a page loads.
@@ -246,14 +250,14 @@ Learn more about [**Custom Functions**](../../../ff-concepts/adding-customizatio
246
250
## FAQS
247
251
<details>
248
252
<summary>
249
-
How is a Code Expression different from an Inline Function?
253
+
How is a Custom Code Expression different from an Inline Function?
250
254
</summary>
251
255
<p>
252
-
Code Expressions are a more advanced and flexible version of **Inline Functions.
256
+
Custom Code Expression is a more advanced and flexible version of Inline Function.
253
257
254
-
With Inline Functions, you had to manually pass values as arguments. In contrast, Code Expressions let you directly reference FlutterFlow generated resources (such as `FFAppState()`, `_model`, context, and more) without needing to pass them in.
258
+
With Inline Functions, you had to manually pass values as arguments. In contrast, Custom Code Expressions let you directly reference FlutterFlow generated resources (such as `FFAppState()`, `_model`, context, and more) without needing to pass them in.
255
259
256
-
You can write any valid Dart expression in a code expression, even multi-line logic using anonymous functions. Plus, Code Expressions support real-time autocomplete and inline error validation, making it much easier to discover available variables and avoid mistakes.
260
+
You can write any valid Dart expression in a Custom code expression, even multi-line logic using anonymous functions. Plus, Custom Code Expressions support real-time autocomplete and inline error validation, making it much easier to discover available variables and avoid mistakes.
0 commit comments