Skip to content

Instantly share code, notes, and snippets.

@sodogan
Created October 29, 2020 08:11
Show Gist options
  • Save sodogan/f108d8176f637ff3ad3b5e4f5e37f5d1 to your computer and use it in GitHub Desktop.
Save sodogan/f108d8176f637ff3ad3b5e4f5e37f5d1 to your computer and use it in GitHub Desktop.
/*
Dart samples:
To copy a list or map
use:
var myList = [...myBaseList];
var myMap = {...myBaseMap};
*/
void main(List<String> args) {
Map<String, String> myBaseMap = <String, String>{}
..addAll({'Turkey': 'Istanbul'})
..putIfAbsent('Australia', () => 'Canberra')
..putIfAbsent('Australia', () => 'Canberra');
print(myBaseMap);
//how do you define list of Maps?
List<Map<String, List<String>>> interests = [
{
'solen': ['dance', 'swim']
}
]..add({
'eren': ['dance', 'swim']
});
var hisInterests = {...interests};
print(hisInterests);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment