toDate method

DateTime? toDate([
  1. String format = 'yyyy-MM-dd'
])

Implementation

DateTime? toDate([String format = 'yyyy-MM-dd']) {
  try {
    return DateTime.parse(this);
  } catch (_) {
    return null;
  }
}