clearHistory method

void clearHistory()

Clears the state history while keeping the current state.

Implementation

void clearHistory() {
  _checkNotDisposed();
  _stateHistory
    ..clear()
    ..add(state); // Re-add current state
}