title: Flutter/Dart - FutureBuilder bool not returning bool
body: <p>I've got a boolean provided by <code>ChangeNotifierProvider</code> which grabs true or false from <code>SharedPreferences</code>.  It should update to &quot;true&quot; once a user has logged in.  I'm calling this boolean from a FutureBuilder. However, instead of getting the correct boolean, all I'm getting is the <code>CircularProgressIndicator()</code> indicating something has gone wrong. Here's the code;</p>
  <pre><code>Widget build(BuildContext context) {
          var socialProvider = Provider.of&lt;SocialProvider&gt;(context);
          return FutureBuilder&lt;bool&gt;(
            future: socialProvider.loadCurrentLogged(),
            builder: (context, snapshot){
              if(!snapshot.hasData) {
                return
                  Column(
                    children: &lt;Widget&gt;[
                      Row(
                        children: &lt;Widget&gt;[
                          Consumer&lt;SocialProvider&gt;(
                            builder: (context, socialProvider, _) =&gt;
                                Container(
                                  child: new RaisedButton(
                                    onPressed: () {
                                      if (snapshot.data != true) {
                                        //Do something here.
                                      } else { // } //switch end
                                    }
                                   ),
                                ),
                             ),
                          ),
                        ],
                      ),
                    ],
                  );
              } else {return
                Center(
                    child: CircularProgressIndicator()
                );
              }
            },
          );
        }
  </code></pre>
  <p>And here's the future provided by the <code>ChangeNotifierProvider</code>;</p>
  <pre><code> Future&lt;bool&gt; loadCurrentLogged() async {
      SharedPreferences prefs = await SharedPreferences.getInstance();
      bool currentlogged = prefs.getBool('currentlogged') ;
      return currentlogged;
    }
  </code></pre>
  <p>What's wrong?</p>