lastWhereIndexedOrNull method

T? lastWhereIndexedOrNull(
  1. bool test(
    1. int index,
    2. T element
    )
)

The last element whose index and value satisfies test.

Returns null if no element and index satisfies test.

Implementation

T? lastWhereIndexedOrNull(bool Function(int index, T element) test) {
  T? result;
  var index = 0;
  for (var element in this) {
    if (test(index++, element)) result = element;
  }
  return result;
}