As we all know in every programming language Data types is the main base. Data types is a type of particular defined data holders used to hold a single or multiple type of data in every programming language. In Dart there are basically 6 Types of Data type available. So in this tutorial we would see and learn complete List of All Data Types Available in Dart Flutter Explained with Examples.
List of All data types in DART:
- Numbers – int, double
- String
- Boolean
- List
- Map
- Runes
1. Numbers:
1. int : Integer is a type of non fractional number value without. Here non fractional means a value without point. Integer dose not support POINT values. It can only hold pure numeric values. See the example below.
1 2 3 4 5 |
int tempNum = 123456; print(tempNum); // Output should be : 123456 |
2. double : Double are basically bigger type of FLOAT values. It can hold fractional decimal values. In dart the double support 64 bit double prescription values. double also represents floating point literals.
1 2 3 4 5 |
double i = 52.11 ; print(i); // Output should be 52.11 |
2. String :
String data type represents a sequence of multiple characters text also known as group of multiple characters. In Dart string is sequence of UTF-16 code units. String can be created using both single quotes and double quotes but both should be same a creation time.
1 2 3 4 5 6 7 |
String name1 = 'Flutter'; String name2 = "Examples"; print(name1 + ' ' +name2); // Output should be Flutter Examples |
3. Boolean :
Boolean data type is used to hold true and false values. Boolean data type uses the ‘bool‘ keyword on declaration time.
1 2 3 4 5 6 7 8 9 |
bool val1 = true; bool val2 = false; print(val1); print (val2); // Output should be true & false |
4. List :
List is a group of multiple data with same data type like a collection box. We could say List is like an Array to hold same type of multiple values. The store in ordered sequence in List and Like array every single ITEM of List can be accessed via its index number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
List<int> rollNum = List(6); rollNum[0] = 1; rollNum[1] = 2; rollNum[2] = 3; rollNum[3] = 4; rollNum[4] = 5; rollNum[5] = 6; for (int elements in rollNum) { print(elements); } // Output should be : 1 2 3 4 5 6 |
5. Map:
Same as List data type Map data type is also a type of group of multiple values. In Map the data stored in key:value pairs format. There is no bound for key value they can be in any type. Map date can also have null type of values. Map are like objects with multiple values.
1 2 3 4 5 6 7 8 |
var temp = { "roll_num": "123", "phoneNum": "0987654321", "name": "Pankaj", }; print(temp); // Output should be : {roll_num: 123, phoneNum: 0987654321, name: Pankaj} |
6. Runes :
Rune data type in a integer representing of a Unicode data point. We can create different type of shapes that dose supported by Unicode using runes.
1 2 3 4 5 |
var heart = '\u2665'; print(heart); Output should be : ♥ |
Thanks for reading my tutorial guys, Hope you have like it 🙂 .
can you give me tutorials
inbox me