lastWhereOrNull method

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

Implementation

E? lastWhereOrNull(bool test(E element)) {
  if (this == null || this!.isEmpty) return null;
  E? result;
  bool foundMatching = false;
  for (E element in this!) {
    if (test(element)) {
      result = element;
      foundMatching = true;
    }
  }
  if (foundMatching) return result;
  return null;
}