toDateTime method

DateTime? toDateTime()

Parses string to DateTime

returns null when it's an invalid date Refer to this for the accepted format

Implementation

DateTime? toDateTime() {
  if (this == null) return null;

  return DateTime.tryParse(this!);
}