PressPage constructor
PressPage({})
Creates a parsed content page.
Implementation
PressPage({
required Iterable<String> slug,
required this.location,
required this.title,
required this.content,
required this.sourcePath,
this.description,
this.order = 0,
this.draft = false,
this.language,
}) : slug = List<String>.unmodifiable(slug) {
if (title.trim().isEmpty) {
throw ArgumentError.value(title, 'title', 'Must not be empty.');
}
if (!location.hasAbsolutePath ||
location.hasScheme ||
location.hasAuthority ||
location.hasQuery ||
location.hasFragment) {
throw ArgumentError.value(
location,
'location',
'Must be an absolute local path without query or fragment.',
);
}
for (final segment in this.slug) {
if (segment.isEmpty ||
segment == '.' ||
segment == '..' ||
segment.contains('/') ||
segment.contains(r'\')) {
throw ArgumentError.value(slug, 'slug', 'Contains an invalid segment.');
}
}
}