SitemapGenerator class
Generates XML sitemap files for search engine crawlers.
final sitemap = SitemapGenerator(
baseUrl: 'https://myapp.com',
entries: [
SitemapEntry(path: '/', priority: 1.0, changeFrequency: ChangeFrequency.daily),
SitemapEntry(path: '/about', priority: 0.8),
SitemapEntry(path: '/products', priority: 0.9),
],
);
final xml = sitemap.generate();
// Write to web/sitemap.xml
Constructors
-
SitemapGenerator({required String baseUrl, required List<
SitemapEntry> entries, String? xslStylesheet})
Properties
- baseUrl → String
-
The base URL of your website (e.g., 'https://myapp.com')
final
-
entries
→ List<
SitemapEntry> -
List of sitemap entries
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- xslStylesheet → String?
-
Optional XML stylesheet URL
final
Methods
-
generate(
) → String - Generate the complete sitemap XML string
-
generateMinified(
) → String - Generate a minified version (no extra whitespace)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited