parent property Null safety

Element? parent

The parent element of this node.

Returns null if this node either does not have a parent or its parent is not an element.

Implementation

Element? get parent {
  final parentNode = this.parentNode;
  return parentNode is Element ? parentNode : null;
}