parse static method
Parses the component from the specified text
.
When succeeding, this returns a VCalendar, VEvent or similar
component as defined by the given text
.
The text
can either contain \r\n
(CRLF
) or \n
line-breaks, when
both line-break types are present in the text
, CRLF
line-breaks
are assumed.
Folded lines are unfolded automatically.
When you have a custom line delimiter, use parseLines instead.
Define the customParser
if you want to support specific properties.
Note that unknown properties will be made available with getProperty,
e.g. final value = component.getProperty('X-NAME')?.textValue;
Implementation
static VComponent parse(
String text, {
Property? Function(String name, String definition)? customParser,
}) {
final lines = unfold(text);
if (lines.isEmpty) {
throw FormatException('Invalid input: [$text]');
}
return parseLines(lines, customParser: customParser);
}