Skip to content

Update style-guide.md #294

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 2 commits into from
Mar 10, 2025
Merged
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions docs/resources/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ When naming custom data types and enums, use **UpperCamelCase** for consistency
- **Don’t Mix Naming Conventions for Enums:** Maintain consistent capitalization between enum names and their values. Bad Example: `enum UserRole { Admin, EDITOR, viewer }`
:::

For datatype fields, we use the same convention as [State variables](#state-variables).

### Constants

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.
Expand All @@ -104,9 +106,9 @@ Flutter prefers using a lowercase `k` prefix for constants to indicate their imm
- **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`.
:::

### State Variables
### State Variables & Data Type Fields

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

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

## Function Naming Convention
Expand Down
Loading