int firstIndexOf(bool Function(E element) test) { var index = 0; for (final element in this) { if (test(element)) { return index; } index++; } return -1; }