hasChild method

bool hasChild(
  1. String elementName
)

Returns true if this element contains a direct child named elementName.

elementName must not be null or empty.

Implementation

bool hasChild(String elementName) {
  assert(elementName.isNotEmpty);
  if (children == null) return false;
  elementName = elementName.toLowerCase();
  for (var child in children!) {
    if (child is XmlElement && child.name.toLowerCase() == elementName) {
      return true;
    }
  }
  return false;
}