title: How to get a List from another class
body: <p>I have a characterList class that has a <code>final List &lt;Character&gt; character</code> field;
  How can I access the <code>character</code> from the <code>SWMain</code> class?</p>
  <p>SWMain class:</p>
  <pre><code>class _SWMainState extends State&lt;SWMain&gt; {
    Icon customIcon = Icon(Icons.search);
    static Text titleText = Text(&quot;Star Wars API&quot;);
    Widget customSearchBar = titleText;
  
   @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          appBar: AppBar()
          body: FutureBuilder&lt;List&lt;Character&gt;&gt;(
            future: fetchCharacters(http.Client()),
            builder: (context, snapshot) {
              if (snapshot.hasError) print(snapshot.error);
              return snapshot.hasData
                  ? CharacterList(character: snapshot.data)
                  : Center(child: CircularProgressIndicator());
            },
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>characterList class:</p>
  <pre><code>class CharacterList extends StatelessWidget {
    final List&lt;Character&gt; character;
    CharacterList({Key key, this.character}) : super(key: key);
  ...
  }
  </code></pre>