isDateAfterToday method
Returns true if this date is strictly after today (i.e., tomorrow or later).
Pass now to override the current time (useful for testing).
Example:
DateTime.now().add(Duration(days: 1)).isDateAfterToday(); // true
DateTime.now().isDateAfterToday(); // false
Implementation
bool isDateAfterToday({DateTime? now}) {
final DateTime currentNow = now ?? DateTime.now();
// End of today = start of tomorrow minus one microsecond
final DateTime endOfToday = DateTime(
currentNow.year,
currentNow.month,
currentNow.day,
).add(const Duration(days: 1)).subtract(const Duration(microseconds: 1));
return isAfter(endOfToday);
}