You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I getting this error Unhandled Exception: 'package:date_range_picker/date_range_picker.dart': Failed assertion: line 1280 pos 10: '!initialLastDate.isAfter(lastDate)': initialDate must be on or before lastDate and the dialog won't show up. Any help would appreciated. 🙏
This is my code :
Future<List<DateTime>> _showDateRangePicker() async {
final List<DateTime> pickedDateRange = await DateRangePicker.showDatePicker(
context: context,
initialFirstDate: new DateTime(2020, 1, 1),
initialLastDate: new DateTime(2020, 4, 1),
firstDate: new DateTime(2015),
lastDate: new DateTime(2020)
);
if(pickedDateRange == null && pickedDateRange.length < 2) {
return [];
}
return pickedDateRange;
}
The text was updated successfully, but these errors were encountered:
Hi @McSam94,
I had the same error ,
the problem is between initialFirstDate & lastDate
when you initiate the lastSAte like this: new DateTime(2020), you'll have the same date as the initialFirstDate I think so that's why it caught that exception:
Try to change the lastDate like this lastDate: (new DateTime.now()).add(new Duration(days: 7))
I getting this error
Unhandled Exception: 'package:date_range_picker/date_range_picker.dart': Failed assertion: line 1280 pos 10: '!initialLastDate.isAfter(lastDate)': initialDate must be on or before lastDate
and the dialog won't show up. Any help would appreciated. 🙏This is my code :
The text was updated successfully, but these errors were encountered: