toHtml method
Implementation
String toHtml() {
final buffer = StringBuffer();
if (title != null) buffer.writeln('<title>$title</title>');
if (charset != null) buffer.writeln('<meta charset="$charset" />');
if (description != null) {
buffer.writeln('<meta name="description" content="$description" />');
}
if (keywords != null) {
buffer.writeln('<meta name="keywords" content="$keywords" />');
}
if (viewport != null) {
buffer.writeln('<meta name="viewport" content="$viewport" />');
}
if (author != null) {
buffer.writeln('<meta name="author" content="$author" />');
}
if (robots != null) {
buffer.writeln('<meta name="robots" content="$robots" />');
}
meta.forEach((name, content) {
buffer.writeln('<meta name="$name" content="$content" />');
});
links.forEach((rel, href) {
buffer.writeln('<link rel="$rel" href="$href" />');
});
for (final css in styles) {
buffer.writeln('<style>$css</style>');
}
for (final js in scripts) {
buffer.writeln('<script>$js</script>');
}
buffer.write(
'<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>');
return buffer.toString();
}