Event.fromMap constructor

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

Implementation

factory Event.fromMap(Map<String, dynamic> map) {
  return Event(
    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,
    stamp: map['stamp'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['stamp'].toString()))
        : 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,
    endDate: map['end_date'] != null
        ? DateTime.fromMillisecondsSinceEpoch(
            int.parse(map['end_date'].toString()))
        : null,
    sequence: map['sequence']?.toInt(),
    transparency: map['transparency'],
    status: map['status'] != null ? EventStatus.fromMap(map['status']) : null,
    timeZone:
        map['time_zone'] != null ? TimeZone.fromMap(map['time_zone']) : null,
    recurrenceRule: map['recurrenceRule'] != null
        ? RecurrenceRule.fromMap(map['recurrenceRule'])
        : null,
    xDates: map['x_dates'] != null
        ? List<XDate>.from(map['x_dates']?.map((x) => XDate.fromMap(x)))
        : null,
    location:
        map['location'] != null ? Location.fromMap(map['location']) : null,
    recurrenceId: map['recurrence_id'],
    eventClass: map['event_class'],
    customProperties: map['custom_properties'] != null
        ? Map<String, String>.from(map['custom_properties'])
        : null,
    attachFiles: map['attach_files'] != null
        ? List<Attachment>.from(
            map['attach_files']?.map((x) => Attachment.fromMap(x)))
        : null,
  );
}