subtract method Null safety
- Duration duration
DateTime today = DateTime.now(); DateTime fiftyDaysAgo = today.subtract(const Duration(days: 50));
Notice that the duration being subtracted is actually 50 * 24 * 60 * 60
seconds. If the resulting
DateTime has a different daylight saving offset
this, then the result won't have the same time-of-day as
may not even hit the calendar date 50 days earlier.
Be careful when working with dates in local time.
external DateTime subtract(Duration duration);