toString method
A string representation of this object.
Some classes have a default textual representation,
often paired with a static parse
function (like int.parse).
These classes will provide the textual representation as
their string representation.
Other classes have no meaningful textual representation
that a program will care about.
Such classes will typically override toString
to provide
useful information when inspecting the object,
mainly for debugging or logging.
Implementation
@override
String toString() {
// TODO: implement toString
String tosend = '<svg';
for (String key in attributes.keys) {
tosend += ' $key="${attributes[key]}"';
}
if (style.isNotEmpty) {
tosend += 'style=';
for (String key in style.keys) {
tosend += '"$key: ${style[key]};"';
}
}
tosend += '>';
if (styleNodes.isNotEmpty) {
tosend += '<style type="text/css">.st{stroke:#33333;stroke-width:1;}';
for (int i = 0; i < styleNodes.length; i++) {
tosend += '.st$i{';
for (String key in styleNodes[i].keys) {
if (styleNodes[i][key] != 'null') {
tosend += '${styleNodes[i][key]}';
}
}
tosend += '}';
}
tosend += '</style>';
}
if (childNodes.isNotEmpty) {
for (int i = 0; i < childNodes.length; i++) {
tosend += '<path';
for (String key in childNodes[i].keys) {
String? data = childNodes[i][key];
if (edgeOnly) {
data = SvgEdgeFinder().reduce(childNodes[i][key]!);
}
tosend += ' $key="$data"';
}
tosend += ' class="st$i st"></path>';
}
}
tosend += '</svg>';
return tosend;
}