parseCompactDate method Null safety

  1. @override
DateTime? parseCompactDate(
  1. String? inputString
)
override

Converts the given compact date formatted string into a DateTime.

The format of the string must be a valid compact date format for the given locale. If the text doesn't represent a valid date, null will be returned.

See also:

Implementation

@override
DateTime? parseCompactDate(String? inputString) {
  try {
    return inputString != null ? _compactDateFormat.parseStrict(inputString) : null;
  } on FormatException {
    return null;
  }
}