isOrContains function

bool isOrContains(
  1. Element? root,
  2. Element? other
)

Returns whether root is the same as or contains the other node.

Returns false if either root or other is null.

Implementation

bool isOrContains(Element? root, Element? other) => (
  (root != null && other != null) &&
  (root == other || root.contains(other))
);