Question: I have a datepicker in flutter. Now I need to disable all the previous days from present date in calendar in flutter. When I tried to do , it only disable the one previous day.
If someone can try this, it will be helpful.

```
final DateTime picked = await showDatePicker(
    selectableDayPredicate: (DateTime val) =>
    val.day == DateTime.now().day - 1 ? false : true,
    context: context,
    initialDate: DateTime.now(),
    firstDate: new DateTime.now().subtract(new Duration(days: 30)),
    lastDate: DateTime(2101));

```

Answer: 
Better Answer is below it will disable **previous** **dates**

```html
final DateTime picked = await showDatePicker(
  context: context,
  initialDate: DateTime.now(),
  firstDate: DateTime.now().subtract(Duration(days: 0)),
  lastDate: DateTime(2100),
);

```
for disabling future dates just set lastDate to present date which disable every date after current date

```
 await showDatePicker(
  context: context,
  initialDate: _selectedDate,
  firstDate: DateTime(1850),
  lastDate: DateTime.now(),
);

```

and for diabling previous date set firstDate to current date which disable every date before current date

```
 await showDatePicker(
  context: context,
  initialDate: _selectedDate,
  firstDate:DateTime.now(),
  lastDate: DateTime(2050),
);

```