updateEventStateHistory method

  1. @protected
void updateEventStateHistory(
  1. MatexCountryBlocEvent event,
  2. MatexCountryBlocState nextState
)
inherited

Updates the event-state history. The event-state history is used to determine the event related to a given state.

Implementation

@protected
void updateEventStateHistory(E event, S nextState) {
  if (enableForceBuildEvents) {
    if (eventStateHistory.length > eventStateHistorySize) {
      // Limit the event-state history map size
      final oldestEvent = eventStateHistory.keys.first;
      eventStateHistory.remove(oldestEvent);
    }

    if (eventStateHistorySize > 0) {
      // Update the event-state history
      final eventHistory = (eventStateHistory[event] ?? [])
        ..add(nextState.uuid);

      eventStateHistory[event] = eventHistory;
    }
  }
}