ICalendar.fromString constructor

ICalendar.fromString(
  1. String icsString, {
  2. bool allowEmptyLine = true,
})

Parse an ICalendar object from a String. The parameter icsString will be split using LineSplitter then calling ICalendar.fromLines.

The first line must be BEGIN:VCALENDAR, and the last line must be END:VCALENDAR.

The body MUST include the "PRODID" and "VERSION" calendar properties.

Implementation

factory ICalendar.fromString(String icsString, {bool allowEmptyLine = true}) {
  final strBuffer = StringBuffer(icsString);
  const lineSplitter = LineSplitter();
  final lines = lineSplitter.convert(strBuffer.toString());
  return ICalendar.fromLines(lines, allowEmptyLine: allowEmptyLine);
}