Todo.fromMap constructor

Todo.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory Todo.fromMap(Map<String, dynamic> map) {
  return Todo(
    uid: map['uid'] ?? '',
    summary: map['summary'],
    description: map['description'],
    attachments: map['attachments'] != null
        ? List<Attachment>.from(
            map['attachments']?.map((x) => Attachment.fromMap(x)))
        : null,
    attendees: map['attendees'] != null
        ? List<Attendee>.from(
            map['attendees']?.map((x) => Attendee.fromMap(x)))
        : null,
    organizer:
        map['organizer'] != null ? Organizer.fromMap(map['organizer']) : null,
    created: map['created'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['created'].toString()))
        : null,
    lastModified: map['last_modified'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['last_modified'].toString()))
        : null,
    startDate: map['start_date'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['start_date'].toString()))
        : null,
    dueDate: map['due_date'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['due_date'].toString()))
        : null,
    completedDate: map['completed_date'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['completed_date'].toString()))
        : null,
    recurrenceRule: map['recurrence_rule'] != null
        ? RecurrenceRule.fromMap(map['recurrence_rule'])
        : null,
  );
}