age property
int?
get
age
Calculates age (useful for birthdates).
Implementation
int? get age {
if (this == null) return null;
final today = DateTime.now();
int age = today.year - this!.year;
if (today.month < this!.month ||
(today.month == this!.month && today.day < this!.day)) {
age--;
}
return age;
}