Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Naming Conventions in Dart.

Dart has it’s own naming conventions for the Variables, Fields, Methods, Classes, and Packages.

1. Variables and Field name will starts with Lower-Case and every Second word’s first letter will be Upper-Case like firstName, secondName, getAllColors. Using Under-Score in the middle of the Variable or Field Name is discussed in Dart. But you can use the underscore at the beginning of a Variable or File Name and if you do so then it will be a Private Variable or Private Field and it’s Scope will be Local.

2. Class names will starts with Upper-Case letter and every second word’s first letter is also Upper-Case like

class People{
    }

class ProductService{
     } 

class MaterialPageRoute{
   }

If you want to make the class Private then use Under-Score in front of Class name. See Below :-

class _People{
    }

class _ProductService{
     } 

class _MaterialPageRoute{
   }

3. All the Libraries, Packages, Directories, and Source Files will be named LowerCase with UnderScores like lower_case_underscores.

Note :- Constant Names, Methods, Method Parameters will follow the Variable Naming Convention.

     const pi = 3.14 -> const_pi = 3.14
     getAllProducts(){}  -> _getAllProducts(){}
     getProductByName(String name){}