parentElement property Null safety

XmlElement? parentElement

Return the first parent of this node that is of type XmlElement, or null if there is none.

Implementation

XmlElement? get parentElement {
  for (var current = parent; current != null; current = current.parent) {
    if (current is XmlElement) {
      return current;
    }
  }
  return null;
}