Метод forEach
- void action(
- E element
override
Вызывает action для каждого элемента этого итерируемого объекта в порядке итерации.
Пример:
final numbers = <int>[1, 2, 6, 7]; numbers.forEach(print); // 1 // 2 // 6 // 7
Реализация
void forEach(void action(E element)) {
int length = this.length;
for (int i = 0; i < length; i++) {
action(this[i]);
if (length != this.length) {
throw ConcurrentModificationError(this);
}
}
}
© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-collection/ListMixin/forEach.html