Data types in Dart
The data type of a variable is referred to what kind of information that variable or item can have.
Data types can be found all around us, numbers, characters that are labeled based on the properties they share.
I will show you in this lesson the fourth main data types;
- Integer : stores numeric values without a decimal point, for example, the value “123”.
- Double : also stores numeric values but with the decimal point, for example, “12,3”.
- String : represent an array of characters like name, address..
- Boolean : a data type that stores only one of two values; True or false, it represented using the (bool) keyword.
A Tesla car example :
int mph = 164;
double carPrice = 200.800;
String carName = “Tesla”;
bool electricCar = true;
The first word refers to the data type, the second one stands for the variable name and the last one is the value of each variable.