how can I get the selected time of TimePickerDialog in Flutter? I dont want to use showDialog because I want to add some other buttons below the TimePickerDialog. When it is not possible to use the TimePickerDialog then what would be the way to do it? Use the sourcecode of Timepickerdialog in my local workspace and update it there? I am using it like this:
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
actions: <Widget>[
SizedBox(
child: TimePickerDialog(
initialTime: TimeOfDay.fromDateTime(DateTime.now()),
cancelText: "",
confirmText: "",
),
),
TextButton(
child: Text('Cancel'),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: Text('OK'),
onPressed: () {
// Perform an action
Navigator.of(context).pop();
},
),
],
);
},
);

According to the official docs here, the value returned by showDialog is the selected TimeOfDay if the user taps the "OK" button, or null if the user taps the "CANCEL" button.
So you need to call the
showDialogwith theawaitkeyword.