isAfter 方法

bool isAfter(
  1. DateTime other
)

判断此 DateTime 是否在 other 之后。

比较与时间是否在 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);