title: Flutter find Widget in List<Widget>
body: <p>I have a list of widgets:</p>
  
  <pre><code>List&lt;Widget&gt; widgetList = List&lt;Widget&gt;();
  
  widgetList.add(WidgetA());
  widgetList.add(WidgetB());
  widgetList.add(WidgetC());
  widgetList.add(WidgetD());
  </code></pre>
  
  <p>Now I want to find WidgetB in the list:</p>
  
  <pre><code>Widget activeWidget = widgetList.firstWhere((x) =&gt; x.key == ??);
  </code></pre>
  
  <p>I'm assmuning the <strong>"key"</strong> property is what I should use to uniquely identify each widget but I'm not sure what type of key to use or how to find by the key, nor if this is the correct approach.</p>
  
  <p>Any information would be helpful thanks.</p>