onSubmit property Null safety

(dynamic Function?(Object)?) onSubmit
final

Called whenever the confirm button tapped on date range picker. The dates or ranges that have been selected are confirmed and the selected value is available in the value argument.

See also:


Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Date Range Picker'),
        ),
        body: Container(
            child: SfDateRangePicker(
          showActionButtons: true,
          onSubmit: (Object value) {
            if (value is PickerDateRange) {
              final DateTime rangeStartDate = value.startDate!;
              final DateTime rangeEndDate = value.endDate!;
            }​ else if (value is DateTime) {​
              final DateTime selectedDate = value;
            }​ else if (value is List<DateTime>) {​
              final List<DateTime> selectedDates = value;
            }​ else if (value is List<PickerDateRange>) {​
              final List<PickerDateRange> selectedRanges = value;
            }​
          },
        )));
  }

Implementation

final Function(Object)? onSubmit;