我正在 flutter 中开发一个应用程序,我想在其中显示带有 webfeed plugin 的 RSS 提要.
我完全按照这个例子,但唯一打印的是:
Instance of 'RssFeed'
它不应该打印整个 RSS 提要吗?还是我理解有误?
代码:
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:webfeed/webfeed.dart';
class Food extends StatelessWidget{
final client = http.Client();
rssStream(){
client.get("https://developer.apple.com/news/releases/rss/releases.rss").then((response) {
return response.body;
}).then((bodyString) {
var channel = new RssFeed.parse(bodyString);
print(channel);
return channel;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: Image.asset('assets/icon.png'),
title: Text('App'),
),
body: rssStream(),
);
}
}
最佳答案
您看到的一切都是正确的。您正在打印出 RssFeed 的一个实例。您需要打印出您想要的属性。
查看 gihub 中的代码,我可以看到 few properties .您最感兴趣的可能是项目。这是 RssItem 的实例。查看 RssItem 并打印出您想要在那里打印的属性详细信息。
只需查看代码,自己查看模型结构,以获得更好的见解。
关于android - 在 Flutter 中使用网络订阅源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55197630/