toDate static method

DateTime toDate(
  1. String value, {
  2. String format = kDateFormat,
})

Implementation

static DateTime toDate(String value, {String format = kDateFormat}) {
  try {
    return DateFormat(format).parse(value);
  } catch (e) {
    return DateTime.now();
  }
}