serialize method

  1. @override
String serialize()
override

Implementation

@override
String serialize() {
  var out = StringBuffer();

  uid ??= nanoid(32);

  out.writecrlf('UID:$uid');

  if (categories != null) {
    out.writecrlf('CATEGORIES:${categories!.map(escapeValue).join(',')}');
  }

  if (comment != null) {
    out.writecrlf('COMMENT:${escapeValue(comment!)}');
  }
  if (summary != null) {
    out.writecrlf('SUMMARY:${escapeValue(summary!)}');
  }
  if (url != null) {
    out.writecrlf('URL:$url');
  }
  if (classification != null) {
    out.writecrlf('CLASS:$classification');
  }
  if (description != null) {
    out.writecrlf('DESCRIPTION:${_foldLines(escapeValue(description!))}');
  }
  if (rrule != null) out.write(rrule!.serialize());

  return out.toString();
}