age property

int get age

Returns the age in years based on this date.

Implementation

int get age {
  final today = DateTime.now().toUtc().add(App.timezone.offset);
  int years = today.year - year;
  if (today.month < month || (today.month == month && today.day < day)) {
    years--;
  }
  return years;
}