toICalString method
Implementation
String toICalString() {
final buffer = StringBuffer();
buffer.writeln('BEGIN:VJOURNAL');
buffer.writeln('UID:$uid');
if (summary != null) {
buffer.writeln('SUMMARY:$summary');
}
if (description != null) {
buffer.writeln('DESCRIPTION:$description');
}
if (attachments != null && attachments!.isNotEmpty) {
for (final attachment in attachments!) {
buffer.writeln(attachment.toICalString());
}
}
if (attendees != null && attendees!.isNotEmpty) {
for (final attendee in attendees!) {
buffer.writeln(attendee.toICalString());
}
}
if (organizer != null) {
buffer.writeln(organizer!.toICalString());
}
if (created != null) {
buffer.writeln(
'CREATED:${DateFormat('yyyyMMdd\'T\'HHmmss\'Z\'').format(created!.toUtc())}');
}
if (lastModified != null) {
buffer.writeln(
'LAST-MODIFIED:${DateFormat('yyyyMMdd\'T\'HHmmss\'Z\'').format(lastModified!.toUtc())}');
}
if (startDate != null) {
buffer.writeln(
'DTSTART:${DateFormat('yyyyMMdd\'T\'HHmmss\'Z\'').format(startDate!.toUtc())}');
}
if (endDate != null) {
buffer.writeln(
'DTEND:${DateFormat('yyyyMMdd\'T\'HHmmss\'Z\'').format(endDate!.toUtc())}');
}
if (recurrenceRule != null) {
buffer.writeln(recurrenceRule!.toICalString());
}
buffer.writeln('END:VJOURNAL');
return buffer.toString();
}