isAfter method
Whether this DateTime occurs after other
.
The comparison is independent of whether the time is in UTC or in the local time zone.
final now = DateTime.now();
final later = now.add(const Duration(seconds: 5));
print(later.isAfter(now)); // true
print(!now.isBefore(now)); // true
// This relation stays the same, even when changing timezones.
print(later.isAfter(now.toUtc())); // true
print(later.toUtc().isAfter(now)); // true
print(!now.toUtc().isAfter(now)); // true
print(!now.isAfter(now.toUtc())); // true
Implementation
@override
bool isAfter(DateTime other) => toUtc().isAfter(other.toUtc());