age method
Returns the age at today
(or current time) for the date.
日付に対してのtoday
(もしくは現在時刻)における年齢を返します。
final date = DateTime(1984, 8, 2).age(DateTime(2022, 10, 26)); // year: 38, month: 2, day: 24
Implementation
DateDuration age([DateTime? today]) {
return _differenceDate(today ?? DateTime.now());
}