[FormBuilderDateTimePicker]: Got problem if initialDate is null and lastDate is years ago. #1368
Open
2 of 7 tasks
Labels
bug
Something isn't working
Is there an existing issue for this?
Package/Plugin version
9.2.1
Platforms
Flutter doctor
Flutter doctor
Minimal code example
Code sample
Current Behavior
Got error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/material/date_picker.dart': Failed assertion: line 201 pos 5: 'initialDate == null || !initialDate.isAfter(lastDate)': initialDate 2024-02-13 00:00:00.000 must be on or before lastDate 2006-12-31 00:00:00.000.
Expected Behavior
The code should work for a null initialDate.
Steps To Reproduce
Add the form:
And click the field to select a date.
Aditional information
In _showDatePicker, if there is no initialDate, it will set to DateTime.now():
So, it can't pass the assert:
The text was updated successfully, but these errors were encountered: