newItunesType function

ItunesType newItunesType(
  1. XmlElement element
)

Creates an ItunesType value based on the inner text of the given XmlElement.

This function takes an XmlElement and checks its inner text to determine the type of the iTunes item. It returns the corresponding ItunesType value based on the inner text.

If the inner text matches 'episodic', ItunesType.episodic is returned. If the inner text matches 'serial', ItunesType.serial is returned. Otherwise, ItunesType.unknown is returned.

Implementation

ItunesType newItunesType(XmlElement element) {
  switch (element.innerText) {
    case 'episodic':
      return ItunesType.episodic;
    case 'serial':
      return ItunesType.serial;
    default:
      return ItunesType.unknown;
  }
}