addYears method
Adds a specified number of years to the current DateTime instance.
Example usage:
final date = DateTime(2020, 1, 1);
final newDate = date.addYears(2);
print(newDate); // 2022-01-01 00:00:00.000
Implementation
DateTime addYears(int amount) => DateTime(year + amount, month, day, hour, minute, second);