initialSelectedRange property

PickerDateRange? initialSelectedRange
final

The date range to initially select on the SfDateRangePicker.

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

Defaults to null.

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

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

See also:


Widget build(BuildContext context) {
return MaterialApp(
     home: Scaffold(
       body: SfDateRangePicker(
         view: DateRangePickerView.month,
         selectionMode: DateRangePickerSelectionMode.range,
         initialSelectedRange: PickerDateRange(
             DateTime.now().subtract((Duration(days: 4))),
             DateTime.now().add(Duration(days: 4))),
       ),
     ),
   );
}

Implementation

final PickerDateRange? initialSelectedRange;