variables
In this example, the variable name
contains the value "John."
Naming Convention for Variables in Dart
It's a good practice to follow naming conventions for variables. In Dart, variable names should start with a lowercase letter, and for every subsequent word, the first letter should be capitalized. This convention is known as lowerCamelCase
. For example, num1
, fullName
, and isMarried
are valid variable names following this convention.
File Naming Conventions
File naming conventions help ensure consistency in naming files across your organization. Here are some popular cases:
Camel Case (camelCase
)
camelCase
)Camel case capitalizes all words except the first word and removes spaces between them. For instance, "public domain software" can be written as publicDomainSoftware
.
Pascal Case (PascalCase
)
PascalCase
)Pascal case capitalizes all words in the name, including the first word, and removes spaces between them. For instance, "public domain software" can be written as PublicDomainSoftware
.
Snake Case (snake_case
)
snake_case
)Snake case combines words by replacing spaces with underscores (_
). Using the same example, "public domain software" becomes public_domain_software
.
Kebab Case (kebab-case
)
kebab-case
)Kebab case is similar to snake case, but it replaces spaces with dashes (-
). The file name "public domain software" in kebab case is public-domain-software
.
Last updated