title: How to update a widget state from another widget in Flutter using global Key?
body: <p>I have a main widget screen contain two main widgets a Header (marked with red) and a list (marked with purple)
  <a href="https://i.stack.imgur.com/OnNaw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OnNaw.png" alt="my main screen widget" /></a> <br>
  here is my code for that :</p>
  <pre><code>    class ScreenClient extends StatefulWidget {
        _ClientState createState() =&gt; _ClientState();
      }
      
      class _ClientState extends State&lt;ScreenClient&gt; {
        @override
        Widget build(BuildContext context) {
          return Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: &lt;Widget&gt;[
              ClientHeader(), // this is my header widget red
              Expanded(
                child: ClientList(), // this is my list widget purple
              ),
            ],
          );
        }
      }
  </code></pre>
  <p>the header widget has three options as you can see <code>Tous</code> <code>Bloqué</code> and <code>ayant Retard</code> , what I'm trying to achieve is pass the value of the clicked option to the list widget marked with purple (because those options are filters and the list elements should be shown based on the chosen option)
  <br> I have a hard time understanding state management packages and from what I understand <code>Global Keys</code> can do the trick but How ? .
  here is my header widget code :</p>
  <pre><code>class ClientHeader extends StatefulWidget {
    _HeaderClientState createState() =&gt; _HeaderClientState();
  }
  
  class _HeaderClientState extends State&lt;ClientHeader&gt; {
    String nomSituation;
    String option = &quot;Tous&quot;;
  
    @override
    Widget build(BuildContext context) {
      return Container(
        child: Row(
          children: &lt;Widget&gt;[
            GestureDetector(
              child: Text(
                &quot;Tous&quot;,
                style: TextStyle(
                  color: option == &quot;Tous&quot; ? Colors.white : Colors.grey[400],
                ),
              ),
              onTap: () {
                setState(() {
                  option = &quot;Tous&quot;;
                });
              },
            ),
            GestureDetector(
              child: Text(
                &quot;Bloqué&quot;,
                style: TextStyle(
                  color: option == &quot;Bloqué&quot; ? Colors.white : Colors.grey[400],
                ),
              ),
              onTap: () {
                setState(() {
                  option = &quot;Bloqué&quot;;
                  //add send value to ClientList widet ?
                });
              },
            ),
            GestureDetector(
              child: Text(
                &quot;Ayant Retard&quot;,
                style: TextStyle(
                  color:
                      option == &quot;Ayant Retard&quot; ? Colors.white : Colors.grey[400],
                ),
              ),
              onTap: () {
                setState(() {
                  option = &quot;Ayant Retard&quot;;
                });
              },
            ),
          ],
        ),
      );
    }
  }
  </code></pre>