setDateAndAnimate method
void
setDateAndAnimate(})
This function will animate to any date that is passed as an argument.
The selection becomes exactly [date] in every mode.
In case a date is out of range nothing will happen
Implementation
void setDateAndAnimate(DateTime date,
{Duration duration = const Duration(milliseconds: 500),
Curve curve = Curves.linear}) {
final state = _datePickerState;
if (state == null) return;
if (_indexOfDate(date) == null) return; // date is out of range
state._setSelectedDate(date);
// May be null when the picker isn't laid out yet — select without
// scrolling in that case.
_animateToOffset(_targetOffsetForDate(date), duration, curve);
}