List list = []; list.add(Customer('Jack', 23)); list.add(Customer('Adam', 27)); list.add(Customer('Katherin', 25)); ... var map1 = Map.fromIterable(list, key: (e) => e.name, value: (e) => e.age); print(map1);
{Jack: 23, Adam: 27, Katherin: 25}