In the onPressed event of the “Add Item” button, we add a new item then call setState in order to rebuild WidgetA and all it’s inner widgets , including WidgetB: onPressed: () => setState(() { items.
In the onPressed event of the “Add Item” button, we add a new item then call setState in order to rebuild WidgetA and all it’s inner widgets , including WidgetB: onPressed: () => setState(() { items.