isAfter method Null safety
- DateTime other
Returns true if this 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
bool isAfter(DateTime other) => _value.isAfter(other);