isYesterday static method
Checks if the provided microseconds represent a date that occurred yesterday
Takes a microseconds
value and converts it into a DateTime object.
Compares this date with yesterday's date to determine if they match
in terms of day, month, and year.
Returns true if the date represented by microseconds
is yesterday;
otherwise, returns false.
Implementation
static bool isYesterday(int microseconds) {
var calendar = DateTime.fromMicrosecondsSinceEpoch(microseconds);
final yesterday = DateTime.now().subtract(const Duration(days: 1));
return yesterday.day == calendar.day &&
yesterday.month == calendar.month &&
yesterday.year == calendar.year;
}