title: Unable to save sharepreference in flutter
body: <p>I am trying to call <code>saveName</code> but nothing is being saved. And also I can see that commit is deprecated so how do you save values within <code>SharedPreferences</code></p>
  
  <pre><code>Future saveName(bool isloggedIn,String passwordval) async {
      sharedPreferences = await SharedPreferences.getInstance();
      sharedPreferences.setBool("is_logged_in ", isloggedIn);
      sharedPreferences.setString("password ", passwordval);
      sharedPreferences.commit();
    }
  
    getCredential() async {
      print("###coming inside getcredentials");
      sharedPreferences = await SharedPreferences.getInstance();
      setState(() {
        isloggedIn = sharedPreferences.getBool("is_logged_in");
        if (isloggedIn != null) {
          if (isloggedIn) {
            print("###isloggedin=true");
            passwordController.text = sharedPreferences.getString("password");
          } else {
            print("###isloggedin=false");
            passwordController.clear();
            sharedPreferences.clear();
          }
        } else {
          isloggedIn = false;
        }
      });
    }
  </code></pre>