RssContent.parse constructor

RssContent.parse(
  1. XmlElement element
)

Factory method to create an RssContent object from an XmlElement.

This method parses the element and extracts the inner text (content) from it. It also uses the _imagesRegExp regular expression to find image URLs in the content and stores them in the images property as an iterable of strings.

The extracted content is assigned to the value property, and the found image URLs are stored in images.

Implementation

factory RssContent.parse(XmlElement element) {
  final dynamic content = element.innerText;
  final images = <String>[];
  _imagesRegExp.allMatches(content).forEach((match) {
    images.add(match.group(1)!);
  });
  return RssContent(content, images);
}