addAncestorStatesToEnter method
Walks up the tree collecting states to enter.
If this sees a parallel state on the way up, will also collect that state's descendents.
Implementation
@visibleForTesting
void addAncestorStatesToEnter(State<T> state, [State<T>? ancestor]) {
for (var anc in state.ancestors(upTo: ancestor)) {
if (anc is RootState<T>) continue;
_statesToEnter.add(anc);
if (anc.isParallel) {
for (var child in anc.substates) {
if (!_statesToEnter.any((s) => s.descendsFrom(child))) {
addDescendantStatesToEnter(child);
}
}
}
}
}