saveHistory method
Saves the current state of s to history (if s contains a history state).
Implementation
void saveHistory(State<T> s) {
if (!s.containsHistoryState) return;
final values = historyValuesFor(s, activeStates);
history.add(s, values);
}