How to convert a List into a Map in Dart

前端 未结 4 2079
醉酒成梦
醉酒成梦 2021-01-01 08:44

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\'         


        
4条回答
  •  一个人的身影
    2021-01-01 09:32

    There is not yet a concept of tuples or pairs in dart (other than a two element Iterable). If Dart had such a concept, then issue 7088 proposes to solve this with a Map.fromPairs constructor.

提交回复
热议问题