initialSelectedDates property

List<DateTime>? initialSelectedDates
final

The collection of dates to initially select on the SfDateRangePicker.

If it is not null the SfDateRangePicker will select the dates that set to this property.

Defaults to null.

Note: If the controller and it's controller.selectedDates property is not null then this property will be ignored and the widget render the selection for the dates given in controller.selectedDates.

It is only applicable when the selectionMode set as DateRangePickerSelectionMode.multiple.

See also:


Widget build(BuildContext context) {
return MaterialApp(
     home: Scaffold(
       body: SfDateRangePicker(
         view: DateRangePickerView.month,
         selectionMode: DateRangePickerSelectionMode.multiple,
         initialSelectedDates: <DateTime>[
           DateTime.now().add((Duration(days: 4))),
           DateTime.now().add((Duration(days: 5))),
           DateTime.now().add((Duration(days: 9))),
           DateTime.now().add((Duration(days: 11)))
         ],
       ),
     ),
   );
}

Implementation

final List<DateTime>? initialSelectedDates;