class_docstr: The `AppStateWatcher` enables a Frontend to:
  
  - Subscribe to any App state changes.
  - To access and change the App state from the UI.
  
  This is particularly useful for the `PanelFrontend , but can be used by
  other frontends too.
  
  Example
  -------
  
  .. code-block:: python
  
      import param
  
      app = AppStateWatcher()
  
      app.state.counter = 1
  
  
      @param.depends(app.param.state, watch=True)
      def update(state):
          print(f"The counter was updated to {state.counter}")
  
  
      app.state.counter += 1
  
  This would print ``The counter was updated to 2``.
  
  The ``AppStateWatcher`` is built on top of Param, which is a framework like dataclass, attrs and
  Pydantic which additionally provides powerful and unique features for building reactive apps.
  
  Please note the ``AppStateWatcher`` is a singleton, i.e., only one instance is instantiated
code: def _update_flow_state(self):
      # Todo: Consider whether to only update if ._state changed
      # This might be much more performant.
      with edit_constant(self):
          self.state = self._get_flow_state()
      _logger.debug("Requested App State.")
  
file_path: pytorch-lightning/src/lightning/app/frontend/panel/app_state_watcher.py
imports: from __future__ import annotations
  import os
  from lightning.app.frontend.panel.app_state_comm import _watch_app_state
  from lightning.app.frontend.utils import _get_flow_state
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.imports import _is_param_available, requires
  from lightning.app.utilities.state import AppState
label_desc: Use image node_id 5 for calling the AppStateWatcher obj's underlying member method code with example usage: obj._update_flow_state() without return types