serialize method

  1. @override
String serialize()
override

Implementation

@override
String serialize() {
  var out = StringBuffer()
    ..writecrlf('BEGIN:VALARM')
    ..writecrlf('ACTION:$type');
  switch (type) {
    case IAlarmType.DISPLAY:
      out.writecrlf(_serializeDescription());
      break;
    case IAlarmType.EMAIL:
      out.writecrlf(_serializeDescription());
      out.writecrlf('SUMMARY:${escapeValue(summary!)}');

      // TODO ATTENDEE
      break;
    case IAlarmType.AUDIO:
      // TODO: Handle this case.
      break;
  }

  if (repeat > 1) {
    out.writecrlf('REPEAT:$repeat');
    out.writecrlf('DURATION:${utils.formatDuration(duration)}');
  }

  if (trigger != null) {
    out.writecrlf(
        'TRIGGER;VALUE=DATE-TIME:${utils.formatDateTime(trigger!)}');
  }

  out.writecrlf('END:VALARM');
  return out.toString();
}