tryParse static method
Constructs a new DateTime instance based on dateStr
.
Works like parse except that this function returns null
where parse would throw a FormatException.
Implementation
static Date? tryParse(
String dateStr, {
String? format,
bool utc = false,
}) {
try {
return parse(
dateStr,
format: format,
utc: utc,
);
} on FormatException {
return null;
}
}