parseOrNullWithFormat static method

DateTime? parseOrNullWithFormat(
  1. String date,
  2. String format
)

Returns the value converted from date to format. If conversion fails, null is returned.

Implementation

static DateTime? parseOrNullWithFormat(String date, String format) {
  try {
    return intl.DateFormat(format).parseStrict(date);
  } catch (e) {
    return null;
  }
}