getFormattedDateToDateTime static method
Implementation
static DateTime? getFormattedDateToDateTime(String date) {
try {
DateFormat inputFormat;
inputFormat = date.contains('-')
? DateFormat('dd-MM-yyyy')
: DateFormat('dd/MM/yyyy');
DateTime inputDate = inputFormat.parse(date);
return inputDate;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}