nextSibling property Null safety

XmlNode? nextSibling

Return the next sibling of this node, or null.

Implementation

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