parse method

Date parse(
  1. String s
)

Parses a string with format '2020-12-31'. Throws FormatException if the parsing fails.

Implementation

static Date parse(String s) {
  final result = tryParse(s);
  if (result == null) {
    throw FormatException(
      'Date does not match the format "2020-12-31": "$s"',
    );
  }
  return result;
}