serialize method

  1. @override
String serialize()
override

Implementation

@override
String serialize() {
  super.serialize();
  var out = StringBuffer()
    ..writecrlf('BEGIN:VEVENT')
    ..writecrlf('DTSTAMP:${utils.formatDateTime(start)}');

  if ((end == null && duration == null)) {
    out.writecrlf('DTSTART;VALUE=DATE:${utils.formatDate(start)}');
  } else {
    out.writecrlf('DTSTART:${utils.formatDateTime(start)}');
  }

  if (end != null) {
    out.writecrlf('DTEND:${utils.formatDateTime(end!)}');
  }
  if (duration != null) {
    out.writecrlf('DURATION:${utils.formatDuration(duration!)}');
  }
  if (transparency != null) {
    out.writecrlf('TRANSP:$transparency');
  }

  out
    ..writecrlf('STATUS:$status')
    ..write(super.serialize())
    ..write(serializeEventToDo())
    ..writecrlf('END:VEVENT');
  return out.toString();
}