Data Types
Basic Data Types
- String
- bool
- int
- double
- num
List
var numbers = [1,2,3,4];
List<int> numbers = [1,2,3,4];
- 에디터에서 리스트 마지막에 콤마를 찍으면 자동 포매팅
Collection if
var giveMeFive= true;
var numbers = [
1,
2,
3,
4,
if(giveMeFive) 5,
];
}
String Interpolation
var name = 'pgrrr';
var age = 12;
var sentence = 'My name is $name, ${age + 2}';
Collection for[]
var oldF = ['love', 'worm'];
var newF = ['yum', 'sum', 'rokit',
for(var friend in oldF) "GOOD $friend",
];
Maps
var player = {
'name' = 'pgrrr',
'price' = 20,
'power' = false,
};
Map<int, bool> number = {
1 = true,
2 = false,
};
Sets
var numbers = {1,2,3,4,};
Set<int> numbers = {1,2,3,4,};