getAge static method
Get age from birth date
birthDate - The birth date
Returns age in years
Implementation
static int getAge(DateTime birthDate) {
final now = DateTime.now();
int age = now.year - birthDate.year;
if (now.month < birthDate.month ||
(now.month == birthDate.month && now.day < birthDate.day)) {
age--;
}
return age;
}