isTomorrow property

bool get isTomorrow

判断日期是否为明天

返回结果: 若日期为明天,返回true,否则返回false。

示例:

DateTime tomorrow = DateTime.now().add(Duration(days:1));
print(tomorrow.isTomorrow); // true

Implementation

bool get isTomorrow {
  final now = DateTime.now();
  final tomorrow = DateTime(now.year, now.month, now.day + 1);
  return DateTime(year, month, day) == tomorrow;
}