flutterflutter-date-range-picker

Flutter Date Range Picker limit to certain days


How can we allow only selection of 30 days with any start date in DateRangePicker?

Only firstDate and lastDate can be provided, which can be restricted to 30 days starting from the provided firstDate only.


Solution

  • final picked = await showDateRangePicker(
      context: context,
      firstDate: (DateTime.now()).subtract(Duration(days: 30)),
      lastDate: DateTime.now(),
      currentDate: DateTime.now(),
      saveText: 'Done',
    );