rss_generator 1.0.0
rss_generator: ^1.0.0 copied to clipboard
An RSS (Atom) generator
rss_generator #
A pure Dart plugin to generate an RSS file (Atom 2 format).
Validated by the official Feed Validation Service:
To parse an RSS, please have a look at existing solutions on Pub.dev.
Mandatory fields #
In an Atom/RSS fields, here are all the mandatory fields:
- Channel name
- Channel description
- Channel link (= link to a website)
- Atom link (= link to the RSS)
- For each item:
- A title
- A description
- A link
Installation #
- Add
res_generator: ^1.0.0
to yourpubspec.yaml
file. - Import
import 'package:rss_generator/rss_generator.dart';
- Create a
RssBuilder
by proving the multiple mandatory fields:
RssBuilder builder = RssBuilder(
channelName: 'My WebSite',
channelDescription: 'My super website',
channelLink: 'https://flutter-digest.com/',
channelAtomLink: 'https://rss.flutter-digest.com/',
)
.copyright('Copyright 2022')
.pubDate(DateTime.now())
.skipDays({RssSkipDay.friday})
.skipHours({RssSkipHour.hour0})
.ttl(60)
.addItem(
RssItemBuilder(
title: 'Article 1',
description: 'Article 1 description',
link: 'https://archives.flutter-digest.com/latest',
),
);
- You will then receive an
XmlDocument
and just have to call:
XmlDocument doc = builder.build();
// ⬇️ Your document
doc.toXmlString();