isYesterday method

bool isYesterday()

Returns true if a DateTime corresponds to yesterday (Same year and day - 1).

Implementation

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