calculateAge method

int calculateAge()

Retorna a idade com base na data de nascimento

Implementation

int calculateAge() {
  DateTime today = DateTime.now();
  int age = today.year - year;
  if (today.month < month || (today.month == month && today.day < day)) {
    age--;
  }
  return age;
}