tryParse static method

LocalDateTime? tryParse(
  1. String text
)

Returns null for invalid or out-of-range local timestamps.

Implementation

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