In dart there any equivalent to the common:
enumerate(List) -> Iterator((index, value) => f)
or
List.enumerate() -> Iterator((index, value) => f)
or
List.map() -> Iterator((index, value) => f)
It seems that this is the easiest way but it still seems strange that this functionality wouldn't exist.
Iterable<int>.generate(list.length).forEach( (index) => {
newList.add(list[index], index)
});
See Question&Answers more detail:os