prependChildValue method
Inserts a child element with text content as the first child (like addChildValue, which appends).
Implementation
LSLXmlNode prependChildValue(String name, String value) {
if (name.isEmpty) {
throw LSLException('Child name cannot be empty');
}
// lsl_prepend_child_value returns the parent, not the new child.
_withUtf8(
name,
(n) => _withUtf8(value, (v) => lsl_prepend_child_value(xmlPtr, n, v)),
);
final firstChildPtr = lsl_first_child(xmlPtr);
if (firstChildPtr.isNullPointer) {
throw LSLException('Failed to prepend child value: $name');
}
return LSLXmlNode.fromXmlPtr(firstChildPtr);
}