Skip to content

Commit a0de31b

Browse files
authored
Update style-guide.md (#294)
* Update style-guide.md * Apply suggestions from code review
1 parent e070b94 commit a0de31b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/resources/style-guide.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ When naming custom data types and enums, use **UpperCamelCase** for consistency
9090
- **Don’t Mix Naming Conventions for Enums:** Maintain consistent capitalization between enum names and their values. Bad Example: `enum UserRole { Admin, EDITOR, viewer }`
9191
:::
9292

93+
For datatype fields, we use the same convention as [State variables](#variables).
94+
9395
### Constants
9496

9597
Flutter prefers using a lowercase `k` prefix for constants to indicate their immutability, especially for project-specific constants. This approach is more concise and aligns with Dart's common practices. Use **SCREAMING_SNAKE_CASE** only when contributing to global or legacy projects where it is already in use.
@@ -104,9 +106,9 @@ Flutter prefers using a lowercase `k` prefix for constants to indicate their imm
104106
- **Don’t Use Vague or Generic Names:** Avoid using names that fail to describe the purpose of the constant. Bad Examples: `VALUE`, `DATA`, `X`, `Y`.
105107
:::
106108

107-
### State Variables
109+
### Variables
108110

109-
State variable names follow the **lowerCamelCase** naming style to align with Dart's conventions.
111+
State variable & Data Type field names follow the **lowerCamelCase** naming style to align with Dart's conventions.
110112

111113
:::tip[Do's]
112114
- **Be Descriptive and Clear:** Use variable names that clearly describe their purpose, avoiding generic or vague terms. Examples: `isFormValid`, `errorMessage`, `availableProducts`.
@@ -117,7 +119,7 @@ State variable names follow the **lowerCamelCase** naming style to align with Da
117119
:::danger[Don'ts]
118120
- **Don’t Use Abbreviations or Single Letters:** Avoid abbreviations or single-character names that obscure the variable's intent. Bad Examples: `usrNm`, `f`, `cnt`.
119121
- **Don’t Use Generic Names:** Avoid using generic terms that do not convey the variable’s purpose. Bad Examples: `data`, `value`, `temp`.
120-
- **Don’t Start State Variables with Uppercase:** Follow Dart conventions by starting variable names with lowercase. Bad Examples: `UserName`, `IsLoading`.
122+
- **Don’t Start Variables with Uppercase:** Follow Dart conventions by starting variable names with lowercase. Bad Examples: `UserName`, `IsLoading`.
121123
:::
122124

123125
## Function Naming Convention

0 commit comments

Comments
 (0)