setState method

void setState(
  1. T newState
)

Update the state

Implementation

void setState(T newState) {
  _trackDirectAccess();

  // Skip update if state is identical (for references) or equal (for values)
  if (identical(_state, newState) || _state == newState) {
    return;
  }

  if (kDebugMode) {
    developer.log('Store updated: from $_state to $newState', name: 'Store');
  }

  // Update state
  _state = newState;

  // Notify listeners
  _notifyListeners();
}