dateToDB function
Use withTime to return python datetime format
Implementation
String? dateToDB(DateTime? date, {bool withTime = false}) {
if (date == null) {
return null;
}
if (withTime) {
return DateFormat('yyyy-MM-ddTHH:mm:ss.000').format(date);
}
return DateFormat('yyyy-MM-dd').format(date);
}