optionalDateTime function

DateTime? optionalDateTime(
  1. Map<String, dynamic> json,
  2. String key,
  3. String what
)

The DateTime at key when there is one, null when the field is absent, and a FormatException when it is present but not a date.

Implementation

DateTime? optionalDateTime(Map<String, dynamic> json, String key, String what) {
  if (json[key] == null) return null;

  return requireDateTime(json, key, what);
}