The Webfeed Flutter package for Appeto SDK.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

26 righe
633 B

  1. import 'dart:async';
  2. import 'package:http/http.dart' as http;
  3. import 'package:webfeedclient/domain/rss_feed.dart';
  4. import 'package:xml/xml.dart' as xml;
  5. class WebFeedClient {
  6. http.Client client;
  7. WebFeedClient() {
  8. client = new http.Client();
  9. }
  10. Future<RssFeed> fetch(String url) {
  11. return client.get(url).then((response) {
  12. print("Response Status Code: ${response.statusCode}");
  13. print("Response Body: ${response.body}");
  14. return response.body;
  15. }).then((bodyString) {
  16. var document = xml.parse(bodyString);
  17. var channel = new RssFeed.parse(document);
  18. return channel;
  19. });
  20. }
  21. }