A.A
A.A

Reputation: 4121

Dart naming convention

Why in dart we have String not string

Other types are in lower case

Upvotes: 2

Views: 390

Answers (2)

lrn
lrn

Reputation: 71773

The reason for the naming was to make Dart more familiar to people coming from Java (or C#, but mostly Java). That's why int, double, bool and void are lower-case and String is capitalized, because that's what they were in Java (although boolean was considered too damn long). The num type got looped in too, because it's so closely tied to int and double, and dynamic was lower case to mark it as a special type, like void. (Special types added later, like FutureOr or Never, were not made lower case because that increased the risk of conflicting with existing variable names, something the original language didn't have to worry about.)

Dart does not have primitive types like, say, Java. All Dart values are objects, and you can call methods on them.

Upvotes: 4

Maqcel
Maqcel

Reputation: 509

Primitive types are starting with lower case (int, double, char ...). String is not a primitive type its an object therefore it doesn't start with lower case

Upvotes: -1

Related Questions