addApiChange method
adds an API change. This is used by the PackageApiDiffer to add API changes. This method makes sure that the change is added to the list of changes as well as getting inserted into the hierarchical representation
Implementation
void addApiChange(ApiChange change) {
var currentNode = rootNode;
for (int i = change.contextTrace.length - 1; i >= 0; i--) {
final currentContext = change.contextTrace[i];
if (!currentNode.children.containsKey(currentContext)) {
currentNode.children[currentContext] =
ApiChangeTreeNode(nodeDeclaration: currentContext);
}
currentNode = currentNode.children[currentContext]!;
}
currentNode.changes.add(change);
apiChanges.add(change);
}