code: def state_with_changes(self):
      from lightning.app.core import LightningFlow, LightningWork
  
      works = [item for item in self if isinstance(item, LightningWork)]
      children = [
          item for item in self if isinstance(item, LightningFlow)
      ]
      return {
          "works": {
              str(_prepare_name(w)): w.state_with_changes for w in works
          },
          "flows": {
              _prepare_name(flow): flow.state_with_changes
              for flow in children
          },
      }
  
file_path: pytorch-lightning/src/lightning/app/structures/list.py
imports: import typing
  from lightning.app.utilities.app_helpers import _LightningAppRef, _set_child_name
label_desc: Use image node_id 8 for calling the List obj's underlying member method code with example usage: obj.state_with_changes() and returns: dict