dateToString static method
Implementation
static String? dateToString(DateTime? date,
{String format = 'yyyy-MM-dd HH:mm', bool returnNull = false}) {
if (date == null) return returnNull ? null : "";
final DateFormat formatter = DateFormat(format);
final String formatted = formatter.format(date);
return formatted;
}