在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
只需要indexlist.asMap().keys.map((index) { return something; } List<String> list = ['a', 'b', 'c', 'd']; print(list.asMap()); // {0: a, 1: b, 2: c, 3: d} print(list.asMap().keys); // (0, 1, 2, 3) print(list.asMap().keys.map((index) => list[index]).toList()); // [a, b, c, d] 同时访问value和indexlist.asMap().entries.map((entry) { int index = entry.key; String value = entry.value; return something; } List list = ['a', 'b', 'c', 'd']; List ll = list.asMap().entries.map((entry) { int index = entry.key; String value = entry.value; return value + index.toString(); }).toList(); print(ll); // [a0, b1, c2, d3]
|
请发表评论