prependChildElement method

LSLXmlNode prependChildElement(
  1. String name
)

Inserts an empty child element as the first child (like addChildElement, which appends).

Implementation

LSLXmlNode prependChildElement(String name) {
  if (name.isEmpty) {
    throw LSLException('Child name cannot be empty');
  }
  final childPtr = _withUtf8(name, (n) => lsl_prepend_child(xmlPtr, n));
  if (childPtr.isNullPointer) {
    throw LSLException('Failed to prepend child element: $name');
  }
  return LSLXmlNode.fromXmlPtr(childPtr);
}