Skip to content

Custom Action Issues #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/troubleshooting/custom-actions/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"label": "Custom Actions"
}
141 changes: 141 additions & 0 deletions docs/troubleshooting/custom-actions/custom_actions_errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
keywords: ['troubleshooting', 'actions', 'custom']
slug: /custom-actions-errors
title: Custom Actions Errors
---
# Custom Actions Errors

:::info[Prerequisites]
- A basic understanding of how custom actions work.
- A FlutterFlow project with a custom action already created.
:::


Custom actions are powerful, but troubleshooting them can be tricky. This guide will help you systematically resolve common issues.


- **Read the Error Message**

Always read the error message printed during test mode, compilation, or local build. The message often provides a clue about the potential issue.

- **Common Troubleshooting Checklist**

- **Action Name Mismatch**

Ensure the name in the action matches the custom action in your code.

![](../assets/20250430121138021235.png)

:::tip
Use the `Add BoilerPlate Code` option to generate code with the correct action name.
:::

- **Imports and Arguments**

- Check that all required imports are present.
- Ensure arguments are defined in both the action settings and your code.

![](../assets/20250430121138830209.png)

Example:

- Argument 1: Missing definition in settings panel
- Argument 2: Correctly imported
- Argument 3: Nullable selected, but not specified as nullable in code

Follow the steps below to fix this issue:

1. Manually update arguments in both the settings panel and your code.
2. Use the `Add BoilerPlate Code` option (on web, copy only what you need; on desktop, it may replace all code).

![](../assets/20250430121139816551.gif)

- **Name Conflicts**

- Avoid using the same name for an action and its argument.

![](../assets/20250430121142594662.png)

- **Reserved Keywords**

- Do not use Dart/Flutter reserved keywords as argument names. **Examples:** `abstract`, `else`, `import`, `show`, `as`, `enum`, `in`, `static`, `this`.
*FlutterFlow usually warns you, but double-check!*

- **Return Type Mismatch**

- Ensure the custom action returns the correct data type as defined in the settings.

![](../assets/20250430121143268592.png)

*The function should return the type specified in the settings panel.*

- **Internal Library Imports**

- If importing internal libraries (example, `../../flutterflow`), set **Exclude from compilation** to `true` if needed.

- **Pubspec Dependencies**

- Ensure your dependencies are declared in your code and are compatible with FlutterFlow.

![](../assets/20250430121143614166.png)

Check for:
- Version conflicts (check on **[pub.dev](https://pub.dev)**)
- Multiple versions of the same dependency
- Conflicts with FlutterFlow's auto-imported dependencies

![](../assets/20250430121143935249.png)

![](../assets/20250430121144228150.png)

- **Code Errors:**

- **Null values:**

Handle null values safely.

```js
int example = passingIntWhichMayBeNullable ?? 0;
```
- **Correct data types:**

Convert data types explicitly.

```js
String str = "5";
int result = int.parse(str); // ✅
```
Use `.toString()`, `.toInt()`, `.toDouble()` as needed.

- **Single elements** vs **arrays:**

Ensure you are not passing a single element where a list is expected, or vice versa.

- **Exclude from Compilation**

If this option is enabled, the code won’t be checked during build but can still run during test..

![](../assets/20250430121144509497.png)

- **Duplicate Data Types/Structs**

Do not redefine data types or structs already defined in the data schema panel.

![](../assets/20250430121144853131.png)

- **Callback Data Types**

Ensure callback actions return the correct data type.

![](../assets/20250430121145202849.png)


:::info[Additional Resources]
- **Debugging with the Browser Console:** Use the browser debug console for logic errors.
- **FlutterFlow University Video**: [Custom Actions Video](https://www.youtube.com/watch?v=rKaD9eKuZkY).
- **Official Docs:** [Custom Actions | FlutterFlow Docs](/concepts/custom-code/custom-actions/)
:::

:::tip
When in doubt, regenerate the boilerplate and compare with your code. Consistency between settings and code is key!
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
keywords: ['testing', 'debug', 'console']
slug: /testing-custom-actions-using-debug-console
title: Testing Custom Actions Using Debug Console
---
# Testing Custom Actions using Debug Console

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.

:::info[Prerequisites]
- You have created a custom action in FlutterFlow.
- You are familiar with using Run Mode and viewing the browser console.
:::

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:

1. **Add `debugPrint` Statements in the Code**

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.

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

Example:

```js
try {
final result = someFunction();
debugPrint('Function result: $result');
} catch (e) {
debugPrint('Error occurred: $e');
}

2. **Run the App and Open Console**

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.

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

:::info[Still having issues?]
If you continue to experience issues after testing your logic with debugPrint, please contact support at [email protected].​
:::