last static method

DateTime? last(
  1. Iterable<DateTime?>? dates
)

Returns the last date in the list of dates, ignoring null values.

Implementation

static DateTime? last(Iterable<DateTime?>? dates) {
  if (dates == null) return null;
  final filteredDates = dates.whereType<DateTime>();
  if (filteredDates.isEmpty) return null;
  return filteredDates.reduce((a, b) => a.isAfter(b) ? a : b);
}