title: Flutter SharedPreferences getBool function returns null
body: <p>I have the class below which I set and get the bool value to remember the user and auto-login next time.</p>
  
  <pre><code>import 'package:shared_preferences/shared_preferences.dart';
  
  class SettingHelper {
    static Future&lt;bool&gt; getValue(String key) async {
      final SharedPreferences prefs = await SharedPreferences.getInstance();
      var s = prefs.getBool(key);
      print("GetValue ${s.toString()}"); //prints "GetValue true"
      return s;
    }
  
    static Future&lt;void&gt; setValue(String key, bool value) async {
      final SharedPreferences prefs = await SharedPreferences.getInstance();
      prefs.setBool(key, value);
    }
  }
  </code></pre>
  
  <p>I set my value in Login page with a CheckBox value.</p>
  
  <pre><code>onPressed: () {
  ...
  SettingHelper.setValue("rememberMe", checkBoxValue);
  ...
  }
  </code></pre>
  
  <p>When I start debugging I saw setValue worked. 
  But when I hot restart getValue returns null in initState() but returns true in function. Here is the code:</p>
  
  <pre><code>class LandingPage extends StatefulWidget {
    @override
    _LandingPageState createState() =&gt; _LandingPageState();
  }
  
  class _LandingPageState extends State&lt;LandingPage&gt; {
    bool rememberMe;
  
    void _getRememberMeChoice() async {
      rememberMe = await SettingHelper.getValue("rememberMe");
    }
  
    @override
    void initState() {
      super.initState();
      _getRememberMeChoice();
    }
  
    @override
    Widget build(BuildContext context) {
      print(rememberMe);  //Returns null
      if (rememberMe == true) {
        return BridgeList();
      } else
        return LoginScreen();
    }
  }
  </code></pre>
  
  <p>These are the outputs:</p>
  
  <pre><code>I/flutter (11724): null
  I/flutter (11724): GetValue true
  </code></pre>
  
  <p>Please tell me if I'm doing something wrong...</p>