isYesterday property

bool get isYesterday

Returns true if the date is yesterday.

Example:

DateTime.now().subtract(Duration(days: 1)).isYesterday; // true

Implementation

bool get isYesterday {
  final yesterday = DateTime.now().subtract(const Duration(days: 1));
  return year == yesterday.year &&
      month == yesterday.month &&
      day == yesterday.day;
}