getNextSibling static method

XmlElement? getNextSibling(
  1. XmlElement? e
)

Implementation

static XmlElement? getNextSibling(XmlElement? e) {
  if (e == null) {
    return null;
  } else {
    final XmlNode? parentNode = e.parent;
    final int? index = parentNode?.childElements.toList().indexOf(e);
    if (index == null ||
        index == -1 ||
        index == ((parentNode?.childElements.length ?? 0) - 1)) {
      return null;
    } else {
      return parentNode!.childElements.toList()[index + 1];
    }
  }
}