YearPicker constructor Null safety
- {Key? key,
- DateTime? currentDate,
- required DateTime firstDate,
- required DateTime lastDate,
- DateTime? initialDate,
- required DateTime selectedDate,
- required ValueChanged<DateTime> onChanged,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start}
Creates a year picker.
The firstDate, lastDate, selectedDate, and onChanged arguments must be non-null. The lastDate must be after the firstDate.
Implementation
YearPicker({
  super.key,
  DateTime? currentDate,
  required this.firstDate,
  required this.lastDate,
  DateTime? initialDate,
  required this.selectedDate,
  required this.onChanged,
  this.dragStartBehavior = DragStartBehavior.start,
}) : assert(firstDate != null),
     assert(lastDate != null),
     assert(selectedDate != null),
     assert(onChanged != null),
     assert(!firstDate.isAfter(lastDate)),
     currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now()),
     initialDate = DateUtils.dateOnly(initialDate ?? selectedDate);