isDecendentOf method

bool isDecendentOf(
  1. StatePath potentialAncestor
)

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;
}