lastWhereNullable method

E? lastWhereNullable(
  1. bool test(
    1. E element
    )
)

Implementation

E? lastWhereNullable(bool Function(E element) test) {
  late E result;
  bool foundMatching = false;
  for (E element in this) {
    if (test(element)) {
      result = element;
      foundMatching = true;
    }
  }
  if (foundMatching) return result;
  return null;
}