Map
void main(){
Map<String, String> dictionary = {
'Harry Potter' : '해리포터',
'Ron Weasley' : '론 위즐리',
'Hermione Granger' : '헤르미온느 그레인저',
};
print(dictionary);
Map<String, bool> isHarryPotter = {
'Harry Potter' : true,
'Ron Weasley' : true,
'Ironman' : false,
};
print(isHarryPotter);
print(isHarryPotter['Ironman']);
}
Map에 값 추가, 수정하기
isHarryPotter.addAll({
'Spiderman' : false,
});
print(isHarryPotter);
isHarryPotter['Hulk'] = false;
print(isHarryPotter);
isHarryPotter['Spideman'] = true;
print(isHarryPotter);
Map에 값 삭제하기
Map<String, bool> isHarryPotter = {
'Harry Potter' : true,
'Ron Weasley' : true,
'Ironman' : false,
};
print(isHarryPotter);
isHarryPotter.remove('Harry Potter');
print(isHarryPotter);
Map 의 key와 value값들 가져오기
print(isHarryPotter.keys);
print(isHarryPotter.values);