标签:entry ret value val list map ring some return
list.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]
list.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]
标签:entry ret value val list map ring some return
原文地址:https://www.cnblogs.com/liuys635/p/14828616.html