dealWithDuplicateElements method
void
dealWithDuplicateElements()
Implementation
void dealWithDuplicateElements() {
List<GrowingElementNode> rootElements = [];
rootElements.addAll(page.elementNodes.where((n) => !nodeDonotCircle(n)));
for (var childPage in childPages) {
List<GrowingElementNode> childElements = [];
childElements
.addAll(childPage.elementNodes.where((n) => !nodeDonotCircle(n)));
if (childElements.isNotEmpty) {
var firstElement = childElements.first.element;
var lastElement = childElements.last.element;
int firstIndex =
rootElements.indexWhere((node) => node.element == firstElement);
int lastIndex =
rootElements.indexWhere((node) => node.element == lastElement);
if (firstIndex != -1 && lastIndex != -1 && firstIndex <= lastIndex) {
rootElements.removeRange(firstIndex, lastIndex + 1);
}
}
fullPageElements[childPage] = childElements;
}
fullPageElements[page] = rootElements;
}