tsacdop-podcast-app-android/lib/webfeed/domain/rss_enclosure.dart

20 lines
477 B
Dart
Raw Normal View History

2020-02-09 13:29:09 +01:00
import 'package:xml/xml.dart';
class RssEnclosure {
final String url;
final String type;
final int length;
RssEnclosure(this.url, this.type, this.length);
factory RssEnclosure.parse(XmlElement element) {
if (element == null) {
return null;
}
var url = element.getAttribute("url");
var type = element.getAttribute("type");
var length = int.tryParse(element.getAttribute("length") ?? "0");
return RssEnclosure(url, type, length);
}
}