add method

Date add({
  1. int years = 0,
  2. int months = 0,
  3. int days = 0,
})

Implementation

Date add({int years = 0, int months = 0, int days = 0}) =>
    // Let Dart's [DateTime] handle all the arithmetic. It intelligently
    // handles bogus values like (2015, 43, -32) and generally does what we
    // want here. This behavior isn't documented anywhere, but at the very
    // least, treating a day of 0 as the last day of the previous month is
    // guaranteed behavior[1], so it's probably OK to depend on it as long as
    // we also have tests around it.
    //
    // [1]: http://stackoverflow.com/a/14815209
    Date(year + years, month + months, day + days);