isWithinLastHours method
True if this is within the last n hours before now.
Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
bool isWithinLastHours(int n, DateTime now) {
final DateTime cutoff = now.subtract(Duration(hours: n));
return !isBefore(cutoff) && !isAfter(now);
}