flutter dart map code example
Example 1: flutter get key from map
String key = values.keys.elementAt(index);
Example 2: Map in dart
void main() {
var details = new Map();
details['Usrname'] = 'admin';
details['Password'] = 'admin@123';
print(details);
}
// Output
// {Usrname: admin, Password: admin@123}
Example 3: flutter create new map
Map map1 = {'zero': 0, 'one': 1, 'two': 2};
Map map2 = {'zero': 0, 'I': 'one', 10: 'X'};
var map3 = {'zero': 0, 'I': 'one', 10: 'X'};
Example 4: dart list to map
var map1 = Map.fromIterable(list, key: (e) => e.name, value: (e) => e.age);