How to convert a List into a Map in Dart
问题 I looking for an on-the-shelf way to convert a List into a Map in Dart. In python for example you can do: l= [ ('a',(1,2)), ('b',(2,3)), ('c',(3,4) ) ] d=dict(l) ==> {'a': (1, 2), 'c': (3, 4), 'b': (2, 3)} The dict function expects a List of couple. For each couple, the first element is used as the key and the second as the data. In Dart I saw the following method for a List : asMap() , but it's not doing what i expect: it use the list index as key. My questions: Do you known anything in Dart