I am building to do app and I want to add date in the to do list using showtimepicker widget and I when I did it, the widget appear to me but whenever I press ok or cancel it show me the error above '!_debugLocked': is not true.'
TextFormField(
onTap:
() {showTimePicker(context: context, initialTime: TimeOfDay.now());}),
controller: datecontroller,
keyboardType: TextInputType.text
,
onFieldSubmitted: (String value) {
print(value);
},
validator: (String? value) {
if (value!.isEmpty) {
return 'date can\'t be empty';
}
return null;
},
);
I tried to do a function outside the textfromfield but it didn't work because of the error This expression has a type of 'void' so its value can't be used.