serialize method

  1. @override
String serialize()
override

Implementation

@override
String serialize() {
  final buffer = StringBuffer();
  buffer.write('BEGIN:VFREEBUSY\n');
  buffer.write('UID:$uid\n');
  buffer.write('DTSTAMP:${formatDateTime(dtstamp)}\n');
  buffer.write('DTSTART:${formatDateTime(dtstart)}\n');
  buffer.write('DTEND:${formatDateTime(dtend)}\n');
  if (freeTimes != null) {
    for (var freeTime in freeTimes!) {
      buffer.write('FREEBUSY;FBTYPE=FREE:$freeTime\n');
    }
  }
  if (busyTimes != null) {
    for (var busyTime in busyTimes!) {
      buffer.write('FREEBUSY;FBTYPE=BUSY:$busyTime\n');
    }
  }
  if (organizer != null) buffer.write('ORGANIZER:$organizer\n');
  if (contact != null) buffer.write('CONTACT:$contact\n');
  buffer.write('END:VFREEBUSY');
  return buffer.toString();
}