Blogs By Shankar
Dart
Dart
  • Dart Tutorial by Dès Vu Technologies
  • hello
  • Dart Collection
    • collectionInDart
  • File Handeling
    • fileHandelingInDart
  • Functions
    • functionParameters
    • Types of Functions in Dart
    • Functions in Dart
    • Annonymous Function
      • AnnonymousFunction
    • Arrow Function
      • arrowFunctions
    • BuiltinFunctions
      • importantBuiltinFunctions
      • mathFunction
  • OOP With Dart
    • encapsulation
    • oopWithDart
    • Generic In Dart
      • generic
    • constructor
      • constructor
      • factory constructor
        • factoryConstructor
      • initializer list constructor
        • Initializer List Constructor:
    • async dart
      • asyncAndAwait
        • asyncAndAwait
      • future
        • future
      • streams
        • streams
  • Sync and Async dart
    • syncAndAsyncDart
  • controlFlow
    • controlFlow
  • dataTypes
    • Dart Built-In Data Types
    • TypeConversion
    • String
      • stringOperations
      • string_jnterpolation
    • operators
      • Operators In Dart
  • operators
    • operators
  • user_input
    • userInput
  • variablesAndConstants
    • scopeInDart
    • variableTypesInDart
    • variables
Powered by GitBook
On this page
  • Naming Convention for Variables in Dart
  • File Naming Conventions
  1. variablesAndConstants

variables

## Variables in Dart

Variables are containers used to store values in a program. Dart supports different types of variables to store various kinds of values. Here's an example of creating a variable and initializing it in Dart:

```dart
void main() {
  var name = "John";
  print(name);
}

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)

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)

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 combines words by replacing spaces with underscores (_). Using the same example, "public domain software" becomes public_domain_software.

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.

PreviousvariableTypesInDart

Last updated 1 year ago