toDateTime method
Implementation
DateTime toDateTime({String originFormatDate = 'yyyy-MM-dd', String locale = 'ID'}) {
try {
var res = DateFormat(originFormatDate, locale).parse(this);
return res;
} catch (e) {
var res = DateTime.tryParse(this);
if (res == null) throw e.toString();
return res;
}
}