forEachIndexed method

void forEachIndexed(
  1. void action(
    1. int index,
    2. T element
    )
)

Implementation

void forEachIndexed(void Function(int index, T element) action) {
  if (isNotNullAndNotEmpty()) {
    var index = 0;
    for (var element in this!) {
      action(index, element);
      index++;
    }
  }
}