Home > OS >  Why isn't datatypes showing in blue color in vscode
Why isn't datatypes showing in blue color in vscode

Time:02-26

Why here the int variable is not showing in blue color like the class Transaction color in blue mentioned above. And its a .dart file for your clarity

Here is the written code

CodePudding user response:

There is a small difference between the two. class is a reserved keyword and the data types are types, and as such qualify differently to the code editor.

The class is a reserved language word and is painted as blue here. This includes every other special word that has a particular meaning to the language.

All other are identifier for data types. int, String and all others, even though they're built-in to the language, are used here as a data type that qualifies the identifier they're attached to, and as such have the green coloring in your case. Note that it's the same color as Transaction here, as this is a class definition and a class defines a (custom) type too.

CodePudding user response:

class is a keyword. int is a type - in fact, since everything is an object in Dart, int is also a class, just like Transaction that you defined, so it makes sense to have the same color.

And if you really, really think this is wrong, you could always open an issue about it with the author of the Dart extension.

  • Related