Data Types in Dart

Data type is the type of value which the variable holds in itself. Like integer (which we saw in Previous Blog) In the above video, you can watch how I wrote code for different types of variables.

Integers:

The data which is integer, i.e. (- ∞ to ∞) but ...-3,-2,-1,0,1,2,3,... all these values can be holded in a variable whose type is integer
int x = 10 ;

Double:

The data which have decimal point numbers, i.e. (- ∞ to ∞) but ...-3.1, -3.19,...-2.9,...-1, 0,..0.45,...1,.. etc all these values can be holded in a variable whose type is double.
double y = 9.99 ;

String:

The data which have common language sentences or words, like "Hi!", "We are writing code!", etc all these values can be holded in a variable whose type is String.
String a = "I'm coding right now!" ;

Boolean:

The data which can have only two states, either True(1) or False(0) comes under boolean data type. This is similar to digital logic true or false.
bool b = false ;

List:

List is a important data type in Dart which holds a list of items and the indexing of the List starts with 0. Indexing is the way of assigning position to the elements in list. So the first element is at index 0, second at index 1, and so on. List can hold elements of dissimilar data types too. List can be nested(list inside another list) too.
List list = [ 1, 2, 3, 4.89, 'd', 'tech' , true, [6,7], [3,4] ] ;

Maps:

Maps are similar to ordinary dictionary where we have a word and it's associated meaning. Here we declare Key as a word, and Value as its value(meaning). In the below example, first key is 'a' and it's value is integer 1. Same as List we can nest maps too.
Map m = { 'a':1, 'b':4.89, 10:'ten', 'map':{'c':10} } ;

Need more Information?
Click here for YouTube Link
Very Easy! Follow my video lectures on YouTube link and keep reading my blog here for more information. In the video lectures, I have explained all the basic and minor details. The same content will be posted on this website if you like reading more than watching.