toHtml method
Implementation
String toHtml() {
final buffer = StringBuffer();
var attr = "";
if (attrs.isNotEmpty) {
attr = attrs.entries
.map((e) => '${attrKey(e.key)}="${e.value.toString()}"')
.join(' ');
attr = ' $attr';
}
buffer.write('<$_tag$attr');
if (type == TagType.single) {
return '$buffer/>';
} else {
buffer.write('>');
}
for (var child in children) {
buffer.write(child.toHtml());
}
buffer.write('</$_tag>');
var res = buffer.toString();
return res;
}