title: Flutter proper way to call Class within class from properties
body: <p>I have created a class that accepts a list of data as a property. This list contains keys and values that should call additional classes inside the build method.</p>
  <p>I am not certain if this is the correct way to go about it so here is an example to explain what I'm trying to achieve.</p>
  <p>Let's say we call a class called MyToolbar with some data</p>
  <pre><code>MyToolbar(data: [
    {
      'mySecondClass': ['red','green','purple'],
      'mythirdClass': ['yes','no','maybe']
    }
  ])
  </code></pre>
  <p>The class looks like this:</p>
  <pre><code>class MyToolbar extends StatelessWidget {
    MyToolbar({required this.data})
    final List data;
  
  @override
    Widget build(BuildContext context) {
      return Stack(children:[
  // use data file to call classes from the key name: Key(data: itemdata) for each of the classes contained in the data
  
  ])}
  </code></pre>
  <p>I'm guessing that this is not the way to go about it. How can I add additional content to MyToolbar based on the data passed to it.</p>