Date.fromJson constructor

Date.fromJson(
  1. String json
)

Parses an RFC 3339 full-date. Only the calendar components are read — the string is never treated as an instant — so the result is timezone-free.

Implementation

factory Date.fromJson(String json) {
  final dateTime = DateTime.parse(json);
  return Date(dateTime.year, dateTime.month, dateTime.day);
}