YearPicker constructor Null safety

YearPicker(
  1. {Key? key,
  2. DateTime? currentDate,
  3. required DateTime firstDate,
  4. required DateTime lastDate,
  5. DateTime? initialDate,
  6. required DateTime selectedDate,
  7. required ValueChanged<DateTime> onChanged,
  8. 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({
  Key? 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),
     super(key: key);