toDate method

DateTime? toDate()

Converts the string to a DateTime object, using auto-detected or standard formats.

Implementation

DateTime? toDate() {
  if (isBlank) return null;

  return DateTime.tryParse(this) ??
      intl.DateFormat(dateFormat).tryParse(this);
}