What is Built-in Variables in Dart
In this article you will learn about Built-in Variables in Dart Language.
built-in type in dart language
Dart language support different built-in type, some of them is given below-
- String
A dart string is a collection of characters.
Example of String
void main() {
var str1='This is single quotes string';
var str2 =" This is a double quotes string";
print('${str1}');
print("${str2}");
}
|
Output
-
int
Integer number contains integer value without decimal value.
-
double
In double contains both integer and decimal value, basically it used for a large value.
Example of number
void main() {
int val=1;
// int val2=1.1 // Error
print('$val');
var bigInt=1111111111111.11111111111111111111111111111111111111111;
var bigInt1=433453543655467576878799870932143434367576576767676767;
print('$bigInt');
print('$bigInt1');
}
|
Output
Example of boolean
void main()
{
var name=' ';
if(name.isEmpty()){
print("True");
}
else{
print("false");
}
}
|
Output
Example of lists
void main()
{
var list =[1,2,3];
print('$list');
}
|
Output
Example of maps
void main()
{
var maps={
"one":"B",
"two":"C",
"three":"C++" };
var values=maps.getKeys();
values.forEach((g) => print(g));
}
|
Output
Ask Your Question
Got a programming related question? You may want to post your question here