RssItemItunes.parse constructor

RssItemItunes.parse(
  1. XmlElement element
)

Implementation

factory RssItemItunes.parse(XmlElement element) {
  final episodeStr =
      findElementOrNull(element, 'itunes:episode')?.innerText.trim();
  final seasonStr =
      findElementOrNull(element, 'itunes:season')?.innerText.trim();
  final durationStr =
      findElementOrNull(element, 'itunes:duration')?.innerText.trim();

  return RssItemItunes(
    title: findElementOrNull(element, 'itunes:title')?.innerText.trim(),
    episode: episodeStr == null ? null : int.tryParse(episodeStr),
    season: seasonStr == null ? null : int.tryParse(seasonStr),
    duration: durationStr == null ? null : parseDuration(durationStr),
    episodeType: newRssItunesEpisodeType(
      findElementOrNull(element, 'itunes:episodeType'),
    ),
    author: findElementOrNull(element, 'itunes:author')?.innerText.trim(),
    summary: findElementOrNull(element, 'itunes:summary')?.innerText.trim(),
    explicit: parseBoolLiteral(element, 'itunes:explicit'),
    subtitle: findElementOrNull(element, 'itunes:subtitle')?.innerText.trim(),
    keywords: findElementOrNull(element, 'itunes:keywords')
            ?.innerText
            .split(',')
            .map((keyword) => keyword.trim())
            .toList() ??
        const <String>[],
    image: RssItunesImage.parse(findElementOrNull(element, 'itunes:image')),
    category: RssItunesCategory.parse(
      findElementOrNull(element, 'itunes:category'),
    ),
    block: parseBoolLiteral(element, 'itunes:block'),
  );
}