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/data-representation/variables.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ When creating variables in FlutterFlow, there are a few important considerations
34
34
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.
35
35
36
36
:::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.
Copy file name to clipboardExpand all lines: docs/resources/style-guide.md
+31-4Lines changed: 31 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
slug: /resources/style-guide
3
-
title: Naming Variables
3
+
title: Naming Variables & Functions
4
4
description: Naming conventions for FlutterFlow, including guidelines for widgets, components, state variables, constants, and more.
5
5
tags: [Style Guide, Variables]
6
6
keywords: [Style Guide, Variables]
7
7
---
8
8
9
-
# Naming Variables
9
+
# Naming Variables & Functions
10
10
11
11
To make your code more maintainable, readable, and consistent, it’s essential to adopt clear naming conventions for variables, functions, and components.
12
12
@@ -28,6 +28,9 @@ Various naming styles (as suggested by [Dart Effective Style Guide](https://dart
28
28
-**Avoid Abbreviations:** Unless it's a well-known abbreviation, spell out words to avoid confusion.
29
29
30
30
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
+
31
34
32
35
### Pages & Components
33
36
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
57
60
58
61
:::
59
62
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
+
60
67
### Custom Data Types & Enums
61
68
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.
63
70
64
71
:::tip[Do's]
65
72
@@ -107,4 +114,24 @@ State variable names follow the **lowerCamelCase** naming style to align with Da
107
114
-**Don’t Use Abbreviations or Single Letters:** Avoid abbreviations or single-character names that obscure the variable's intent. Bad Examples: `usrNm`, `f`, `cnt`.
108
115
-**Don’t Use Generic Names:** Avoid using generic terms that do not convey the variable’s purpose. Bad Examples: `data`, `value`, `temp`.
109
116
-**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