toJson method
Implementation
Map<String, dynamic> toJson() {
final params = {
'title': title,
'description': description,
'location': location,
'start': start.millisecondsSinceEpoch,
'end': end.millisecondsSinceEpoch,
'timeZone': timeZone,
'allDay': allDay,
'recurrence': recurrence?.toJson(),
};
if (Platform.isIOS) {
if (iosParams != null) {
params['reminderSeconds'] = (iosParams?.reminder?.inSeconds ?? 0);
params['url'] = iosParams?.url;
}
params['calendarId'] = calendarId;
}
if (Platform.isAndroid) {
if (androidParams != null) {
params['reminderMinutes'] = androidParams?.reminderMinutes;
params['reminderTypes'] = androidParams?.reminderType;
params['emailInvites'] =
androidParams?.emailInvites?.map((e) => e.toJson()).toList();
}
params['calendarId'] = int.tryParse(calendarId);
}
return params;
}