toDateTime method

DateTime? toDateTime([
  1. DateFormat? df,
  2. bool utc = false
])

Implementation

DateTime? toDateTime([DateFormat? df, bool utc = false]) {
  try {
    return df == null ? DateTime.tryParse(this) : df.parse(this, utc);
  } catch (_) {
    return null;
  }
}