Variable name is not lowerCamelCase
ID |
dart.maintainability.non_constant_identifier_names |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Naming |
Language |
Dart |
Description
Reports a var or final declaration whose name is not lowerCamelCase - Item_Count, Running_Total, line_count or OrderId. A leading underscore for library privacy is allowed, so _cachedTotal is not reported.
Rationale
Dart’s style guide assigns each casing a job: UpperCamelCase for types, extensions, enums and typedefs, lowercase_with_underscores for files, directories and import prefixes, and lowerCamelCase for everything else. Because the convention is universal in the ecosystem, the casing of a name is information the reader uses without thinking - so Order_Id at a use site reads as a type or an import prefix, and the reader has to look up its declaration to find out otherwise. Mixed conventions inside one codebase also mean nobody can guess a name they have not already seen, which shows up in every search and autocomplete.
The following code illustrates the pattern detected by this rule:
// FLAGGED: Variable name is not lowerCamelCase
var Global_Cart;