pickDOB static method

Future<DateTime?> pickDOB({
  1. required BuildContext context,
  2. PickerStyle style = PickerStyle.platform,
  3. String doneLabel = 'Done',
  4. String cancelLabel = 'Cancel',
  5. Locale? locale,
  6. Color? backgroundColor,
  7. Color? accentColor,
})

Date picker preset for Date of Birth (max = today, default 18 yrs ago).

Implementation

static Future<DateTime?> pickDOB({
  required BuildContext context,
  PickerStyle style = PickerStyle.platform,
  String doneLabel = 'Done',
  String cancelLabel = 'Cancel',
  Locale? locale,
  Color? backgroundColor,
  Color? accentColor,
}) {
  final DateTime now = DateTime.now();
  return pickDate(
    context: context,
    initialDate: DateTime(now.year - 18, now.month, now.day),
    firstDate: DateTime(now.year - 120),
    lastDate: now,
    style: style,
    doneLabel: doneLabel,
    cancelLabel: cancelLabel,
    locale: locale,
    backgroundColor: backgroundColor,
    accentColor: accentColor,
  );
}