-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmap.dart
More file actions
31 lines (27 loc) · 780 Bytes
/
map.dart
File metadata and controls
31 lines (27 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
main() {
// Map in Dart
// Two ways of declaring map --> i) Map Literals ii) Map constructors
// Declaring a Map using Map Literals
// syntax for literals --> var urInd = {key1: value1, key2: value2};
// syntax for constructor --> var urInd = Map();
// map_name[key] = value
// Literals Example
var details = {
'username': 'techwithsam',
'name': 'Samuel Adekunle',
'profession': 'Software Dev',
'age': 18,
'isStudent': false,
};
print(details);
print(details['profession']);
// Contructor Example
var userInfo = Map();
userInfo['uid'] = '001';
userInfo['sesscode'] = 'hjajasas';
userInfo['name'] = 'Samuel Ade';
userInfo['phn'] = 09063484529;
userInfo['isVerify'] = false;
print(userInfo);
print(userInfo['phn']);
}