title: setState() is not working in async calls in flutter
body: <p>I'm trying to read a json file named <code>mood.json</code> and parse it to a list named "data", but when I run <code>setState()</code>, the <code>data</code> never changed, any help about this problem? The code looks like this:
  </p>
  
  <pre><code>class DisplayPage extends StatefulWidget {
      @override
    _DisplayPageState createState() =&gt; new _DisplayPageState();
  }
  
  class _DisplayPageState extends State&lt;DisplayPage&gt; {
    List _data = [];
    Directory dir;
    File jsonFile;
    String jsonPath;
  
      Future getData() async {
      dir = await getApplicationDocumentsDirectory();
      jsonPath = dir.path + "/" + "mood.json";
      jsonFile = new File(jsonPath);
      setState(() {
         _data = json.decode(jsonFile.readAsStringSync());
      });
    }
  
    @override
    void initState() {
      super.initState();
      getData();
      print(_data.length);
    }
  
  
  @override
    Widget build(BuildContext context) {
      return new Scaffold(
        appBar: new AppBar(
          title: new  Text('Mood')
        ),
        body: new ListView.builder(
            itemCount: _data.length,
            itemBuilder: (BuildContext context, int index) {
            return new Card(
            child: new Text(_data[index]["title"]),
            );
            },),
      );
    }
  }
  </code></pre>