tryToDateFormatted method

DateTime? tryToDateFormatted(
  1. String format,
  2. String? locale, {
  3. bool utc = false,
})

Attempts to parse this string using format and locale, returning null on failure.

Implementation

DateTime? tryToDateFormatted(
  String format,
  String? locale, {
  bool utc = false,
}) {
  try {
    return toDateFormatted(format, locale, utc: utc);
  } catch (_) {
    return null;
  }
}