serialize method

  1. @override
String serialize()
override

Implementation

@override
String serialize() {
  final buffer = StringBuffer();
  buffer.write('BEGIN:VTIMEZONE\n');
  buffer.write('TZID:$tzid\n');
  if (standardOffset != null && standardStart != null) {
    buffer.write('BEGIN:STANDARD\n');
    buffer.write('DTSTART:${formatDateTime(standardStart!)}\n');
    buffer.write('TZOFFSETFROM:${Heplers.durationToOffsetString(standardOffset!)}\n');
    buffer.write('END:STANDARD\n');
  }
  if (daylightOffset != null && daylightStart != null) {
    buffer.write('BEGIN:DAYLIGHT\n');
    buffer.write('DTSTART:${formatDateTime(daylightStart!)}\n');
    buffer.write('TZOFFSETTO:${Heplers.durationToOffsetString(daylightOffset!)}\n');
    buffer.write('END:DAYLIGHT\n');
  }
  buffer.write('END:VTIMEZONE');
  return buffer.toString();
}