I am trying to get the image URL from this feed:
<item><title>Tuborg Classic er ikke en pilsner</title><link>https://durst.nu/2020/05/14/tuborg-classic-er-ikke-en-pilsner/</link><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">https://durst.nu/2020/05/14/tuborg-classic-er-ikke-en-pilsner/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://2.gravatar.com/avatar/b36123a06ead4213d98787e5913b6eb7?s=96&d=identicon&r=G" medium="image"><media:title type="html">chrcph</media:title></media:content><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=566" medium="image"/><description>Som pilsner ekspert er det ok at være en pedant, ikke? Pille løs i stort og småt. Være træls. På tværs. Tæt på ulidelig. Det er vel nærmest forventeligt, når man har skrevet en grundbog om pilsner, “Den nøgne øl” … <a href="https://durst.nu/2020/05/14/tuborg-classic-er-ikke-en-pilsner/">Continue reading <span class="meta-nav">→</span></a></description><content:encoded><figure class="wp-block-image size-large"><img data-attachment-id="2192" data-permalink="https://durst.nu/tuborg-classic/" data-orig-file="https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg" data-orig-size="1934,3500" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="tuborg-classic" data-image-description="" data-medium-file="https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=166" data-large-file="https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=566" src="https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=566" alt="" class="wp-image-2192" srcset="https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=566 566w, https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=1132 1132w, https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=83 83w, https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=166 166w, https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=768 768w" sizes="(max-width: 566px) 100vw, 566px" /></figure> <p>Som pilsner ekspert er det ok at være en pedant, ikke?</p> <p>Pille løs i stort og småt. Være træls. På tværs. Tæt på ulidelig.</p> <p>Det er vel nærmest forventeligt, når man har skrevet en grundbog om pilsner, “Den nøgne øl” på 380 sider.</p> <p>Tag nu goe gamle Tuborg Classic. </p> <p>En “traditionel pilsner” står der på etiketten – og med “frisk og fyldig pilsnersmag”.</p> <p>Nej, Tuborg Classic er ikke en pilsner. </p> <p>Det er nok nærmere en wienerøl. </p> <p>Wienerøl er – modsat classic-betegnelsen – en certificeret øltype. </p> <p>Jeg er med på, at der var stilforvirring blandt de ølkyndige i 1993, da Tuborg Classic blev lanceret. Fx ingen Beer Judge Certification Program, men hvis folkene fra markedsføringsafdelingen havde rådført sig med en kyndig brygmester, pilsner brygger, inden lanceringen, kom der næppe til at stå‘traditionel pilsner’ på Tuborg Classic.</p> <p>Hos Beer Judge Certification Program (BJCP), det højeste organ for certificering af øl, har wienerøl en selvstændig kategori, Vienna Lager (7A). </p> <p>Men måske Tuborg Classic skal placeres i en lidt anden kategori hos BJCP, for Tuborg Classic er jo industribryg og så får kategorien præfixet “international” hos BJCP. </p> <p>Så den rette kategori for Tuborg Classic er nok International Amber Lager (2B).</p> <p>Ih, sjovt at være træls.</p> <p></p></content:encoded><category>Uncategorized</category><category>classic</category><category>pilsner</category><category>Tuborg</category><pubDate>Thu, 14 May 2020 07:02:30 GMT</pubDate><comments>https://durst.nu/2020/05/14/tuborg-classic-er-ikke-en-pilsner/#respond</comments><guid isPermaLink="false">http://durst.nu/?p=2191</guid><dc:creator>chrcph</dc:creator><dc:date>2020-05-14T07:02:30Z</dc:date></item><item>
I am getting the title and description from the feed, but I have truble to get the image - - Below are my Flutter code. Please note that there are 2 Media content - How do I get this URL https://chrcph.files.wordpress.com/2020/05/tuborg-classic.jpg?w=566 from the feed into Flutter ?
import 'package:flutter/material.dart';import 'package:webfeed/webfeed.dart';import 'package:http/http.dart' as http;import 'package:url_launcher/url_launcher.dart';import 'package:cached_network_image/cached_network_image.dart';class News extends StatefulWidget { News() : super (); final String title = 'Rss feed Demo'; @override _NewsState createState() => _NewsState();}class _NewsState extends State<News> { //static const String FEED_URL = 'https://www.nasa.gov/rss/dyn/lg_image_of_the_day.rss'; static const String FEED_URL = 'http://www.rssmix.com/u/11631847/rss.xml'; RssFeed _feed; String _title; static const String loadingFeedMsg = 'Loading feed....'; static const String feedLoadErrorMsg = 'Error loading feed'; static const String feedOpenErrorMsg = 'Error opening Feed'; static const String placeholderImg = 'images/no_image.png'; GlobalKey<RefreshIndicatorState> _refreshKey; updateTitle(title){ setState(() { _title = title; }); } updateFeed(feed){ setState(() { _feed = feed; }); } Future<void> openFeed(String url) async { if(await canLaunch((url))){ await launch(url, forceSafariVC: true, forceWebView: false, ); return; } updateTitle(feedOpenErrorMsg); } load() async { updateTitle(loadingFeedMsg); loadFeed().then((result){ if(null == result ||result.toString().isEmpty){ updateTitle(feedLoadErrorMsg); return; } updateFeed(result); updateTitle(_feed.title); }); } Future<RssFeed> loadFeed() async{ try{ final client = http.Client(); final response = await client.get(FEED_URL); return RssFeed.parse(response.body); }catch (e){ return null; } } @override void initState() { super.initState(); _refreshKey = GlobalKey<RefreshIndicatorState>(); updateTitle(widget.title); load(); } title(title){ return Text( title, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w500), maxLines: 2, overflow: TextOverflow.ellipsis, ); } subtitle(subtitle){ return Text( subtitle, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w200), maxLines: 1, overflow: TextOverflow.ellipsis, ); } thumbnail(imageUrl){ return Padding( padding: EdgeInsets.only(left: 15.0), child: CachedNetworkImage( placeholder: (context, url) => Image.asset(placeholderImg), imageUrl: imageUrl, height: 50, width: 70, alignment: Alignment.center, fit: BoxFit.fill, ), ); } rightIcon(){ return Icon( Icons.keyboard_arrow_right, color: Colors.grey, size: 30.0, ); } list(){ return ListView.builder( itemCount: _feed.items.length, itemBuilder: (BuildContext context, int index){ final item = _feed.items[index]; return ListTile( title: title(item.title), subtitle: subtitle(item.description), leading: thumbnail(item.media.content.url), trailing: rightIcon(), contentPadding: EdgeInsets.all(5.0), onTap: () => openFeed(item.link), ); }, ); } isFeedEmpty(){ return null == _feed || null == _feed.items; } body(){ return isFeedEmpty() ? Center( child: CircularProgressIndicator(), ) :RefreshIndicator( key: _refreshKey, child: list(), onRefresh: () => load(), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(_title), ), body: body(), ); }}```