dart map map to List code example
Example 1: dart list to map
var map1 = Map.fromIterable(list, key: (e) => e.name, value: (e) => e.age);
Example 2: dart object to map
class Human {
String name;
int age;
Map<String, dynamic> toMap() {
return {
'name': name,
'age': age,
};
}
}