tryParse static method

LocalDate? tryParse(
  1. String text
)

Returns null when text is invalid or outside the supported range.

Implementation

static LocalDate? tryParse(String text) {
  try {
    return LocalDate.parse(text);
  } on FormatException {
    return null;
  } on RangeError {
    return null;
  }
}