LocalDateTime.parse constructor
LocalDateTime.parse(
- String text
Parses a date and time separated by a space or T, without a timezone.
Implementation
factory LocalDateTime.parse(String text) {
final match = _syntax.firstMatch(text);
if (match == null || match.end != text.length) {
throw const FormatException(
'Expected a local date and time without a timezone.',
);
}
return LocalDateTime(
LocalDate.parse('${match[1]}${match[3] ?? ''}'),
LocalTime.parse(match[2]!),
);
}