isToday property

bool get isToday

Returns true if the date is today.

Example:

DateTime.now().isToday; // true
DateTime(2020, 1, 1).isToday; // false (if not today)

Implementation

bool get isToday {
  final now = DateTime.now();
  return year == now.year && month == now.month && day == now.day;
}