I am using the DatePicker as below to allow user to set Date. I want to save this selected date and time to Firebase as a Timestamp. How do I do that?
Thanks.
showDatePicker(
context: context,
initialDate: widget.isUpdating
? _currentExpense.createdAt.toDate()
: _dateTime, //_currentExpense.createdAt == null,
firstDate: DateTime(2001),
lastDate: DateTime.now())
.then((date) {
_dateTime = date;
setState(() {
dateTimeText = _getDateString(date);
});
});