ElevatedButton(
onPressed: () async {
bool validated = formKey.currentState!.validate();
if (validated) {
formKey.currentState!.save();
final Map data =
Map.from(formKey.currentState!.value);
data['date'] =
(data['date'] as DateTime).millisecondsSinceEpoch;
await eventDBS.create(data);
Navigator.pop(context);
}
When i click on the button occur the error "Unhandled Exception: type 'Null' is not a subtype of type 'DateTime' in type cast" and the currentState shows error without the null check(!), i don't know what to do, i really appreciate any help
