previousSibling property

  1. @override
XmlNode? get previousSibling
inherited

Return the previous sibling of this node, or null.

Implementation

@override
XmlNode? get previousSibling {
  if (parent != null) {
    final siblings = parent!.children;
    for (var i = siblings.length - 1; i > 0; i--) {
      if (identical(siblings[i], this)) {
        return siblings[i - 1];
      }
    }
  }
  return null;
}