tryToDateAutoFormat method

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

Attempts toDateAutoFormat while swallowing parsing errors.

Implementation

DateTime? tryToDateAutoFormat({
  String? locale,
  bool useCurrentLocale = false,
  bool utc = false,
}) {
  try {
    return toDateAutoFormat(
      locale: locale,
      useCurrentLocale: useCurrentLocale,
      utc: utc,
    );
  } catch (_) {
    return null;
  }
}