selectDate function

dynamic selectDate(
  1. BuildContext context
)

Implementation

selectDate(BuildContext context) async {
  final DateTime? picked = await showDatePicker(
    context: context,
    initialDate: DateTime.now(), // Refer step 1
    firstDate: DateTime.now(),
    lastDate: DateTime(2025),
  );
  if (picked != null) return picked;
}