previousDay property
DateTime
get
previousDay
Returns a DateTime representing the day before this DateTime.
Example:
DateTime currentDate = DateTime(2022, 1, 8);
DateTime previousDay = currentDate.previousDay;
print(previousDay); // 2022-01-07 00:00:00.000
The previousDay
extension provides a convenient way to obtain a new DateTime instance
representing the day immediately preceding the original date.
Implementation
DateTime get previousDay => addDays(-1);