title: How to check if an element is present in an xml rss feed
body: <p>I have a widget that display an rss feed.  But not all items contain all elements.  How can I check if an element exists?</p>
  <p>The line fails:</p>
  <pre><code>child: Image.network(item.media.contents.first.url, height: 105, width: 105),
  </code></pre>
  <p>There is no media element. How can I check and skip the offending line?</p>
  <pre><code>  @override
    Widget build(BuildContext context) {
      print (this.feed3.items.length);
      return Scaffold(
        body: ListView.builder(
            itemCount: this.feed3.items.length,
            itemBuilder: (BuildContext ctxt, int index) {
              final item = this.feed3.items[index];
              return   InkWell(
            child: ListTile(
                leading: ConstrainedBox(
                  constraints: BoxConstraints(
                    minWidth: 105,
                    minHeight: 105,
                    maxWidth: 105,
                    maxHeight: 105,
                  ),
                  child: Image.network(item.media.contents.first.url, height: 105, width: 105),
                ),
                title: Text(item.title),
                subtitle: Text(item.pubDate),
                contentPadding: EdgeInsets.all(16.0),
              ),
            onTap: () {
              showLink(item.link);
            },
          );
            }),
      );
    }
  </code></pre>
  <p>This is the <a href="https://rss.app/feeds/_DawozSyanCYfGaQg.xmlRSS%20Feed" rel="nofollow noreferrer">feed</a></p>