Dart Syntax: General Rules

Dart Syntax: General Rules

ยท

1 min read

If we are learn something then first we must aware about there basic rule. So today we discuss some basic rule of the Dart language.

  1. Dart keyword can no be declared as any variable name .

  2. Dart only recognize underscore ( _ ) and Dollar sing ($) in variable name so, you can use use only this two symbol in your variable name , if you use any other special character rather then this two you can face error in your code.

  3. Variable name cannot start from any number it must start from word.

  4. Dart differentiae between lowercase and uppercase so you can use both case to declare different type of variable name.

Here , are some example of Valid and Invalid Variable.

Valid identifiersInvalid identifiers
firstNameVar
first_namefirst name
afirst-name
$hello1number
lastname#num
ย