subtract method Null safety

DateTime? subtract(
  1. Duration duration
)

Returns a new DateTime instance with duration subtracted from this.

Returns null if this is null

final today = DateTime.now();
final fiftyDaysAgo = today.subtract(const Duration(days: 50));

Implementation

DateTime? subtract(Duration duration) => _value?.subtract(duration);