addDescendantStatesToEnter method
Selects active descendents, substituting history values when necessary.
Implementation
@visibleForTesting
void addDescendantStatesToEnter(State<T> state) {
if (state is HistoryState<T>) {
final parent = state.parent!;
if (history.contains(parent)) {
final historyValue = history[parent]!;
for (var s in historyValue) {
addDescendantStatesToEnter(s);
}
for (var s in historyValue) {
addAncestorStatesToEnter(s, state.parent);
}
} else {
_defaultHistoryActions[state.parent!] = state.transition;
for (var s in state.transition.targetStates) {
addDescendantStatesToEnter(s);
}
for (var s in state.transition.targetStates) {
addAncestorStatesToEnter(s, state.parent);
}
}
return; // HistoryState
}
// Non-history state
_statesToEnter.add(state);
if (state.isParallel) {
for (var child in state.substates) {
if (!_statesToEnter.any((s) => s.descendsFrom(child))) {
addDescendantStatesToEnter(child);
}
}
} else if (state.isCompound) {
_statesForDefaultEntry.add(state);
for (var s in state.initialStates) {
addDescendantStatesToEnter(s);
addAncestorStatesToEnter(s, state);
}
}
}