YearPicker constructor

YearPicker(
  1. {Key? key,
  2. DateTime? currentDate,
  3. required DateTime firstDate,
  4. required DateTime lastDate,
  5. @Deprecated('This parameter has no effect and can be removed. Previously it controlled ' 'the month that was used in "onChanged" when a new year was selected, but ' 'now that role is filled by "selectedDate" instead. ' 'This feature was deprecated after v3.13.0-0.3.pre.') DateTime? initialDate,
  6. required DateTime? selectedDate,
  7. required ValueChanged<DateTime> onChanged,
  8. DragStartBehavior dragStartBehavior = DragStartBehavior.start}
)

Creates a year picker.

The lastDate must be after the firstDate.

Implementation

YearPicker({
  super.key,
  DateTime? currentDate,
  required this.firstDate,
  required this.lastDate,
  @Deprecated(
    'This parameter has no effect and can be removed. Previously it controlled '
    'the month that was used in "onChanged" when a new year was selected, but '
    'now that role is filled by "selectedDate" instead. '
    'This feature was deprecated after v3.13.0-0.3.pre.'
  )
  DateTime? initialDate,
  required this.selectedDate,
  required this.onChanged,
  this.dragStartBehavior = DragStartBehavior.start,
}) : assert(!firstDate.isAfter(lastDate)),
     currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now());