parse static method

DateTime? parse(
  1. String? value
)

Parses a string into DateTime. Returns null if invalid.

Implementation

static DateTime? parse(String? value) {
  if (value == null) return null;
  try {
    return DateTime.parse(value);
  } catch (_) {
    try {
      return DateFormat('yyyy-MM-dd HH:mm:ss').parseStrict(value);
    } catch (_) {
      return null;
    }
  }
}