forEachIndexedSC method
- @Deprecated('Dart natively supports this function. Read DartDoc comment for more info.')
- void funcIndexValue(
- int index,
- T element
Deprecation hint: Read the migration guide for more details on migrating.
Applies the function funcIndexValue
to each element of this collection
in iteration order. The function receives the element index as first
parameter index
and the element
as the second parameter.
Applies the function funcIndexValue
to each element of this collection
in iteration order. The function receives the element index as first
parameter index
and the element
as the second parameter.
Example:
['a', 'b', 'c'].forEachIndex((index, value) {
print('$index : $value'); // '0 : a', '1: b', '2: c'
});
Implementation
@Deprecated(
'Dart natively supports this function. Read DartDoc comment for more info.')
void forEachIndexedSC(void Function(int index, T element) funcIndexValue) {
var index = 0;
var iter = iterator;
while (iter.moveNext()) {
funcIndexValue(index++, iter.current);
}
}