Skip to content

Commit 086e0c2

Browse files
committed
add custom actions/func naming style
1 parent 6a6aae3 commit 086e0c2

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

docs/resources/data-representation/variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ When creating variables in FlutterFlow, there are a few important considerations
3434
Start by giving your variable a meaningful and descriptive name that reflects its purpose. This name will be used throughout your app to reference the variable, so it's important to keep it clear and consistent with your naming conventions.
3535

3636
:::tip[Recommended naming convention]
37-
We recommend the `lowerCamelCase` naming convention for variables.
37+
We recommend the `lowerCamelCase` naming convention for variables. Learn more about the **[recommended naming conventions](../style-guide.md)** used in FlutterFlow and Flutter projects.
3838
:::
3939

4040
### Assigning a Data Type to a Variable

docs/resources/style-guide.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
slug: /resources/style-guide
3-
title: Naming Variables
3+
title: Naming Variables & Functions
44
description: Naming conventions for FlutterFlow, including guidelines for widgets, components, state variables, constants, and more.
55
tags: [Style Guide, Variables]
66
keywords: [Style Guide, Variables]
77
---
88

9-
# Naming Variables
9+
# Naming Variables & Functions
1010

1111
To make your code more maintainable, readable, and consistent, it’s essential to adopt clear naming conventions for variables, functions, and components.
1212

@@ -28,6 +28,9 @@ Various naming styles (as suggested by [Dart Effective Style Guide](https://dart
2828
- **Avoid Abbreviations:** Unless it's a well-known abbreviation, spell out words to avoid confusion.
2929

3030

31+
## Variable Naming Convention
32+
This section outlines naming conventions for pages, components, state variables, custom data types, enums, and constants to ensure clarity and consistency throughout the project.
33+
3134

3235
### Pages & Components
3336
Use **UpperCamelCase** for all widgets, components, pages, and screen names to maintain consistency and readability. FlutterFlow ensures clarity by automatically adding "Widget" to widget names when generating code. For components, you can suffix the name with "Component" to clearly distinguish them.
@@ -57,9 +60,13 @@ Similarly, for pages and screens, include "Page" or "Screen" in the name to indi
5760

5861
:::
5962

63+
64+
Note that the style guidelines for Pages and Components also apply to **[Custom Widgets](../ff-concepts/adding-customization/custom-widgets.md)**, as Pages and Components created in FlutterFlow are internally generated as widgets.
65+
66+
6067
### Custom Data Types & Enums
6168

62-
When naming custom data types and enums, use UpperCamelCase for consistency and clarity. Ensure that names are descriptive, providing a clear representation of the entity or purpose.
69+
When naming custom data types and enums, use **UpperCamelCase** for consistency and clarity. Ensure that names are descriptive, providing a clear representation of the entity or purpose.
6370

6471
:::tip[Do's]
6572

@@ -107,4 +114,24 @@ State variable names follow the **lowerCamelCase** naming style to align with Da
107114
- **Don’t Use Abbreviations or Single Letters:** Avoid abbreviations or single-character names that obscure the variable's intent. Bad Examples: `usrNm`, `f`, `cnt`.
108115
- **Don’t Use Generic Names:** Avoid using generic terms that do not convey the variable’s purpose. Bad Examples: `data`, `value`, `temp`.
109116
- **Don’t Start State Variables with Uppercase:** Follow Dart conventions by starting variable names with lowercase. Bad Examples: `UserName`, `IsLoading`.
110-
:::
117+
:::
118+
119+
## Function Naming Convention
120+
This section defines naming conventions for custom functions, actions, and action blocks to maintain consistency, readability, and ease of understanding across the codebase.
121+
122+
### Custom Functions & Actions
123+
124+
Custom functions and custom actions created in the Custom Code tab of FlutterFlow should follow the **lowerCamelCase** naming convention. These typically reflect an action or behavior.
125+
126+
:::tip[Do's]
127+
- **Be descriptive and concise:** Use clear, meaningful names that describe the action or purpose of the function (e.g., `validateForm` instead of `doCheck`, or `fetchUserData` instead of `userData`).
128+
- **Use action-oriented names:** Start with verbs to indicate behavior (e.g., `submitForm`, `processPayment`).
129+
:::
130+
131+
:::danger[Dont's]
132+
- **Avoid using underscores or spaces:** Names like `fetch_user_data` do not align with **lowerCamelCase** conventions.
133+
- **Avoid redundant prefixes or suffixes:** There’s no need to prefix with `custom` or suffix with `Func` unless absolutely necessary for clarity (e.g., `customSubmitFormFunc` is redundant).
134+
- **Don’t use overly generic names:** Avoid vague terms like `doSomething` or `functionOne`, which don’t provide context.
135+
:::
136+
137+
Note that **[Action Blocks](../resources/control-flow/functions/action-blocks.md)** should follow the same naming convention as custom actions, as they are both technically Dart functions internally in the generated code.

0 commit comments

Comments
 (0)