date_time_picker
date_time_picker copied to clipboard
Validator Doest Work.
I tried validator: (val) { DateTime fDate = DateTime.parse(val); print(fDate.weekday); if(fDate.weekday == 1){ return 'false'; } return null; }
But i didn't got the print value.
I tried the same code, and it works fine. But I don't know when you want to get this, because the validator will be called after form save. So, the widget need to be a child of form widget.
Having the same problem here.
Validator is working for normal TextFormField:
validator: (val) { if (val == null || val.isEmpty) return 'Please enter something'; },
However, when putting the same Validator into the DateTimePicker Widget _formkey.currentState!.validate()
return always true which is not the case. What am I doing wrong here?
Having the same problem here.
Validator is working for normal TextFormField:
validator: (val) { if (val == null || val.isEmpty) return 'Please enter something'; },
However, when putting the same Validator into the DateTimePicker Widget
_formkey.currentState!.validate()
return always true which is not the case. What am I doing wrong here?
Ok, I just found the issue. You have to check for val == 'null' (null as a String). Then it works fine.