addDays static method

DateTime addDays(
  1. DateTime date,
  2. int days
)

Returns the DateTime resulting from adding the given number of days to this DateTime.

The result is computed by incrementing the day parts of this DateTime by days days.

For example: (2020, 12, 31) -> add 2 days -> (2021, 01, 2). (2020, 12, 31) -> add 14 days -> (2021, 1, 14).

Implementation

static DateTime addDays(DateTime date, int days) =>
    copyWith(date, day: date.day + days);