lastOrNull method

T? lastOrNull({
  1. bool filter(
    1. T item
    )?,
})

Implementation

T? lastOrNull({bool filter(T item)?}) {
  Iterable<T>? list = this;
  if (filter != null) {
    list = list?.where(filter);
  }
  return list?.isNotEmpty == true ? list?.last : null;
}