diff --git a/docs/troubleshooting/assets/20250430121138021235.png b/docs/troubleshooting/assets/20250430121138021235.png new file mode 100644 index 00000000..2c40d909 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121138021235.png differ diff --git a/docs/troubleshooting/assets/20250430121138830209.png b/docs/troubleshooting/assets/20250430121138830209.png new file mode 100644 index 00000000..c0cc511a Binary files /dev/null and b/docs/troubleshooting/assets/20250430121138830209.png differ diff --git a/docs/troubleshooting/assets/20250430121139816551.gif b/docs/troubleshooting/assets/20250430121139816551.gif new file mode 100644 index 00000000..5ad37aad Binary files /dev/null and b/docs/troubleshooting/assets/20250430121139816551.gif differ diff --git a/docs/troubleshooting/assets/20250430121142594662.png b/docs/troubleshooting/assets/20250430121142594662.png new file mode 100644 index 00000000..c95846a7 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121142594662.png differ diff --git a/docs/troubleshooting/assets/20250430121143268592.png b/docs/troubleshooting/assets/20250430121143268592.png new file mode 100644 index 00000000..a76633ee Binary files /dev/null and b/docs/troubleshooting/assets/20250430121143268592.png differ diff --git a/docs/troubleshooting/assets/20250430121143614166.png b/docs/troubleshooting/assets/20250430121143614166.png new file mode 100644 index 00000000..dc0bb50b Binary files /dev/null and b/docs/troubleshooting/assets/20250430121143614166.png differ diff --git a/docs/troubleshooting/assets/20250430121143935249.png b/docs/troubleshooting/assets/20250430121143935249.png new file mode 100644 index 00000000..91ab9f48 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121143935249.png differ diff --git a/docs/troubleshooting/assets/20250430121144228150.png b/docs/troubleshooting/assets/20250430121144228150.png new file mode 100644 index 00000000..5fa6e512 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121144228150.png differ diff --git a/docs/troubleshooting/assets/20250430121144509497.png b/docs/troubleshooting/assets/20250430121144509497.png new file mode 100644 index 00000000..d2c999ec Binary files /dev/null and b/docs/troubleshooting/assets/20250430121144509497.png differ diff --git a/docs/troubleshooting/assets/20250430121144853131.png b/docs/troubleshooting/assets/20250430121144853131.png new file mode 100644 index 00000000..c10f94ca Binary files /dev/null and b/docs/troubleshooting/assets/20250430121144853131.png differ diff --git a/docs/troubleshooting/assets/20250430121145202849.png b/docs/troubleshooting/assets/20250430121145202849.png new file mode 100644 index 00000000..490f9555 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121145202849.png differ diff --git a/docs/troubleshooting/assets/20250430121216632942.png b/docs/troubleshooting/assets/20250430121216632942.png new file mode 100644 index 00000000..af526401 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121216632942.png differ diff --git a/docs/troubleshooting/assets/20250430121216962021.png b/docs/troubleshooting/assets/20250430121216962021.png new file mode 100644 index 00000000..65589d27 Binary files /dev/null and b/docs/troubleshooting/assets/20250430121216962021.png differ diff --git a/docs/troubleshooting/custom-actions/_category_.json b/docs/troubleshooting/custom-actions/_category_.json new file mode 100644 index 00000000..46ff22c9 --- /dev/null +++ b/docs/troubleshooting/custom-actions/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Custom Actions" +} \ No newline at end of file diff --git a/docs/troubleshooting/custom-actions/custom_actions_errors.md b/docs/troubleshooting/custom-actions/custom_actions_errors.md new file mode 100644 index 00000000..388c7019 --- /dev/null +++ b/docs/troubleshooting/custom-actions/custom_actions_errors.md @@ -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! +::: \ No newline at end of file diff --git a/docs/troubleshooting/custom-actions/testing_custom_actions_using_debug_console.md b/docs/troubleshooting/custom-actions/testing_custom_actions_using_debug_console.md new file mode 100644 index 00000000..0f0bdc41 --- /dev/null +++ b/docs/troubleshooting/custom-actions/testing_custom_actions_using_debug_console.md @@ -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 support@flutterflow.io.​ +::: \ No newline at end of file