lastWhereOrNull method

T? lastWhereOrNull(
  1. bool judgeFunc(
    1. T element
    )
)

Implementation

T? lastWhereOrNull(bool Function(T element) judgeFunc) {
  late T result;
  bool foundMatching = false;
  for (T element in this) {
    if (judgeFunc(element)) {
      result = element;
      foundMatching = true;
    }
  }
  if (foundMatching) return result;

  return null;
}