difference method Null safety

Duration difference(
  1. DateTime other
)

this.

The returned Duration will be negative if other occurs after this.

final berlinWallFell = DateTime.utc(1989, DateTime.november, 9);
final dDay = DateTime.utc(1944, DateTime.june, 6);

final difference = berlinWallFell.difference(dDay);
print(difference.inDays); // 16592

Implementation

Duration difference(DateTime other) => _value.difference(other);