Skip to content

Commit 766e227

Browse files
committed
improved formatting, updated content
1 parent 993acf7 commit 766e227

File tree

3 files changed

+161
-138
lines changed

3 files changed

+161
-138
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
keywords: ['troubleshooting', 'actions', 'custom']
3+
slug: /custom-actions-errors
4+
title: Custom Actions Errors
5+
---
6+
# Custom Actions Errors
7+
8+
:::info[Prerequisites]
9+
- A basic understanding of how custom actions work in FlutterFlow.
10+
- A FlutterFlow project with a custom action already created.
11+
:::
12+
13+
14+
Custom actions in FlutterFlow are powerful, but troubleshooting them can be tricky. This guide will help you systematically resolve common issues.
15+
16+
17+
- **Read the Error Message**
18+
19+
Always read the error message printed during test mode, compilation, or local build. The message often provides a clue about the potential issue.
20+
21+
- **Common Troubleshooting Checklist**
22+
23+
- **Action Name Mismatch**
24+
25+
Ensure the name in the action matches the custom action in your code.
26+
27+
![](../assets/20250430121138021235.png)
28+
29+
:::tip
30+
Use the `Add BoilerPlate Code` option to generate code with the correct action name.
31+
:::
32+
33+
- **Imports and Arguments**
34+
35+
- Check that all required imports are present.
36+
- Ensure arguments are defined in both the action settings and your code.
37+
38+
![](../assets/20250430121138830209.png)
39+
40+
Example:
41+
42+
- Argument 1: Missing definition in settings panel
43+
- Argument 2: Correctly imported
44+
- Argument 3: Nullable selected, but not specified as nullable in code
45+
46+
Follow the steps below to fix this issue:
47+
48+
1. Manually update arguments in both the settings panel and your code.
49+
2. Use the `Add BoilerPlate Code` option (on web, copy only what you need; on desktop, it may replace all code).
50+
51+
![](../assets/20250430121139816551.gif)
52+
53+
- **Name Conflicts**
54+
55+
- Avoid using the same name for an action and its argument.
56+
57+
![](../assets/20250430121142594662.png)
58+
59+
- **Reserved Keywords**
60+
61+
- Do not use Dart/Flutter reserved keywords as argument names. **Examples:** `abstract`, `else`, `import`, `show`, `as`, `enum`, `in`, `static`, `this`.
62+
*FlutterFlow usually warns you, but double-check!*
63+
64+
- **Return Type Mismatch**
65+
66+
- Ensure the custom action returns the correct data type as defined in the settings.
67+
68+
![](../assets/20250430121143268592.png)
69+
70+
*The function should return the type specified in the settings panel.*
71+
72+
- **Internal Library Imports**
73+
74+
- If importing internal libraries (example, `../../flutterflow`), set **Exclude from compilation** to `true` if needed.
75+
76+
- **Pubspec Dependencies**
77+
78+
- Ensure your dependencies are declared in your code and are compatible with FlutterFlow.
79+
80+
![](../assets/20250430121143614166.png)
81+
82+
Check for:
83+
- Version conflicts (check on **[pub.dev](https://pub.dev)**)
84+
- Multiple versions of the same dependency
85+
- Conflicts with FlutterFlow's auto-imported dependencies
86+
87+
![](../assets/20250430121143935249.png)
88+
89+
![](../assets/20250430121144228150.png)
90+
91+
- **Code Errors:**
92+
93+
- **Null values:**
94+
95+
Handle null values safely.
96+
97+
```js
98+
int example = passingIntWhichMayBeNullable ?? 0;
99+
```
100+
- **Correct data types:**
101+
102+
Convert data types explicitly.
103+
104+
```js
105+
String str = "5";
106+
int result = int.parse(str); // ✅
107+
```
108+
Use `.toString()`, `.toInt()`, `.toDouble()` as needed.
109+
110+
- **Single elements** vs **arrays:**
111+
112+
Ensure you are not passing a single element where a list is expected, or vice versa.
113+
114+
- **Exclude from Compilation**
115+
116+
If this option is enabled, the code won’t be checked during build but can still run during test..
117+
118+
![](../assets/20250430121144509497.png)
119+
120+
- **Duplicate Data Types/Structs**
121+
122+
Do not redefine data types or structs already defined in FlutterFlow's data schema panel.
123+
124+
![](../assets/20250430121144853131.png)
125+
126+
- **Callback Data Types**
127+
128+
Ensure callback actions return the correct data type.
129+
130+
![](../assets/20250430121145202849.png)
131+
132+
133+
:::info[Additional Resources]
134+
- **Debugging with the Browser Console:** Use the browser debug console for logic errors.
135+
- **FlutterFlow University Video**: [Custom Actions Video](https://www.youtube.com/watch?v=rKaD9eKuZkY).
136+
- **Official Docs:** [Custom Actions | FlutterFlow Docs](/concepts/custom-code/custom-actions/)
137+
:::
138+
139+
:::tip
140+
When in doubt, regenerate the boilerplate and compare with your code. Consistency between settings and code is key!
141+
:::

docs/troubleshooting/custom-actions/custom_actions_troubleshooting.md

Lines changed: 0 additions & 131 deletions
This file was deleted.
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
11
---
22
keywords: ['testing', 'debug', 'console']
33
slug: /testing-custom-actions-using-debug-console
4-
title: Testing Custom Actions using Debug Console
4+
title: Testing Custom Actions Using Debug Console
55
---
66
# Testing Custom Actions using Debug Console
77

88
Sometimes, the compiler does not show any errors in the custom action, but the custom action still won't work as expected. This might be due to the code logic or the implementation. In order to test the implementation and the flow, you can use the debug console to test the custom action in different scenarios.
99

10-
**Steps for Implementation**:
10+
:::info[Prerequisites]
11+
- You have created a custom action in FlutterFlow.
12+
- You are familiar with using Run Mode and viewing the browser console.
13+
:::
1114

12-
The core function that you can use to test the custom actions on the console is the **debugPrint** function in Flutter. To use that in the custom actions, follow these steps:
15+
The core function that you can use to test the custom actions on the console is the `debugPrint` function in Flutter. To use that in the custom actions, follow the steps below:
1316

14-
- **Step 1**
17+
1. **Add `debugPrint` Statements in the Code**
1518

16-
Use debugPrint to print some error on the debug console in case of a specific result. You can use if-else statements or try-catch statements in order to test the success of the scenario:​
19+
Use `debugPrint` to print some error on the debug console in case of a specific result. You can use if-else statements or try-catch statements in order to test the success of the scenario.
1720

1821
![](../assets/20250430121216632942.png)
1922

20-
- **Step 2**
23+
Example:
24+
25+
```js
26+
try {
27+
final result = someFunction();
28+
debugPrint('Function result: $result');
29+
} catch (e) {
30+
debugPrint('Error occurred: $e');
31+
}
32+
33+
2. **Run the App and Open Console**
2134

2235
After the correct implementation in the code, use the action inside the app. On the run mode, open the console. Now you should be able to see the errors in the console upon performing the action.
2336

2437
![](../assets/20250430121216962021.png)
2538

2639
:::info[Still having issues?]
27-
If you are still running into issues in your implementation after following the outlined steps, please contact support at [email protected].​
40+
If you continue to experience issues after testing your logic with debugPrint, please contact support at support@flutterflow.io.​
2841
:::

0 commit comments

Comments
 (0)