The Webfeed Flutter package for Appeto SDK.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 line
562 B

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