isAfter 方法

bool isAfter(
  1. DateTime other
)

如果 this 发生在 other 之后,则返回 true。

比较与时是否在 UTC 或本地时区无关。

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

实现

external bool isAfter(DateTime other);