Date.fromString constructor

Date.fromString(
  1. String date, {
  2. String pattern = 'yyyy-MM-ddTHH:mm:ssZ',
})

Implementation

factory Date.fromString(String date, {String pattern = 'yyyy-MM-ddTHH:mm:ssZ'}) {
  var datetime = DateFormat(pattern).parse(date);
  return Date(year: datetime.year, month: datetime.month, day: datetime.day);
}