lastWhereOrNull method

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

Returns the last element passing the given test, or null if no such element was found.

Implementation

E? lastWhereOrNull(bool Function(E element) test) {
  E? element;

  for (final elm in this) {
    if (test(elm)) element = elm;
  }

  return element;
}