isDecendentOf method
Returns true if we are a descendant of potentialAncestor
Implementation
bool isDecendentOf(StatePath potentialAncestor) {
StateDefinition? parent = this;
while (parent != null) {
if (parent == potentialAncestor.leaf) {
return true;
}
parent = parent.parent;
}
return false;
}