toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final data = <String, dynamic>{};

  data['calendarId'] = calendarId;
  data['eventId'] = eventId;
  data['eventTitle'] = title;
  data['eventDescription'] = description;
  data['eventStartDate'] = start?.millisecondsSinceEpoch;
  data['eventEndDate'] = end?.millisecondsSinceEpoch;
  data['eventStartTimeZone'] = startTimeZone;
  data['eventEndTimeZone'] = endTimeZone;
  data['eventAllDay'] = allDay;
  data['eventLocation'] = location;
  data['eventURL'] = url?.data?.contentText;
  data['availability'] = availability?.enumToString;

  if (attendees != null) {
    data['attendees'] = attendees?.map((a) => a?.toJson()).toList();
  }
  if (recurrenceRule != null) {
    data['recurrenceRule'] = recurrenceRule?.toJson();
  }
  if (reminders != null) {
    data['reminders'] = reminders?.map((r) => r.toJson()).toList();
  }

  return data;
}