tryParse static method

EtDatetime? tryParse(
  1. String formattedString
)

Constructs a new EtDatetime instance based on formattedString.

Works like parse except that this function returns null where parse would throw a FormatException.

Implementation

static EtDatetime? tryParse(String formattedString) {
  try {
    return parse(formattedString);
  } on FormatException {
    return null;
  }
}