title: getting data after building widgets
body: <p>I am trying to get data from Database, but my widget is built before I can get them...</p>
  <pre><code>class CategoriesWidget extends StatefulWidget {
    @override
    _CategoriesWidgetState createState() =&gt; _CategoriesWidgetState();
  }
  
  class _CategoriesWidgetState extends State&lt;CategoriesWidget&gt; {
    SharedPreferences prefs;
    String token;
    var _isInit = false;
    @override
    void initState() {
      if (!_isInit) {
        super.initState();
        fetchCat();
        _isInit = true;
      }
    }
  
    var categories = {};
    fetchCat() async {
      final prefs = await SharedPreferences.getInstance();
      setState(() {
        token = prefs.getString('api_token');
      });
      await fetchCategories(token).then((result) {
        categories = result[1];
        print(categories);
        print(result[1]);
      });
    }
  
    @override
    Widget build(BuildContext context) {
      final deviceSize = MediaQuery.of(context).size;
      print('2');
      return Column(
       // code here
      );
    }
  }
  </code></pre>
  <p>you can see that I print 1 and 2 to see which one is getting the first and I got as result 2 then 1.</p>