title: Updating data in Flutter
body: <p>I just started learning Dart and Flutter and for starting, I would like to develop an application that acts as a server (to which we send messages from <code>telnet</code>).</p>
  
  <p>So at the moment, I have the two following classes:</p>
  
  <pre><code>class HomeScreen extends StatefulWidget {
      @override
      _HomeScreenState createState() =&gt; new _HomeScreenState();
  }
  </code></pre>
  
  <p>&nbsp;</p>
  
  <pre><code> class _HomeScreenState extends State&lt;HomeScreen&gt; {
      List&lt;String&gt; _messages = &lt;String&gt;[];
  
      ...
  }
  </code></pre>
  
  <p>So as I said, the app will run as a server. I want to update the list <code>_messages</code> every time the server receives a message.</p>
  
  <p>I would like to update it from another class, let's call it <code>Server</code>, from which I call i.e. <code>HomeScreen.addMessage(String message)</code> and I would also like to keep <code>_HomeScreenState</code> private.</p>
  
  <p>I've searched a lot of time for a solution but didn't find anything suitable for my needs.</p>
  
  <p>Could you guys help me?</p>
  
  <p>Many thanks in advance!</p>