title: Anyway to enable 'remember me' function using sharedPreferences in flutter?
body: <p>Currently, I have enabled 'keep logging in' function if the user log in once successfully. However, I still want to make a 'remember me' checkbox to save the success login information for user. Can anyone please help me with this?</p>
  <p>Need: a checkbox that enables the user to store email and password if the user logged in once successfully.</p>
  <p>Code is shown below:</p>
  <pre><code>  signIn(String email, pass) async {
      SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
      String url = ServerDetails.ip +
          ':' +
          ServerDetails.port +
          ServerDetails.api +
          'login';
      Map&lt;String, String&gt; headers = {&quot;Content-type&quot;: &quot;application/json&quot;};
      var data = jsonEncode({
        'email': email,
        'password': pass,
        'token': FirebaseNotifications.fcmtoken
      });
      var jsonResponse = null;
      var response = await http.post(url, headers: headers, body: data);
  
      if (response.statusCode == 200) {
        jsonResponse = json.decode(response.body);
        if (jsonResponse != null) {
          setState(() {
            _isLoading = false;
          });
          sharedPreferences.setString(&quot;token&quot;, jsonResponse['token']);
          sharedPreferences.setString(
              &quot;token_expire_date&quot;, jsonResponse['token_expire_date']);
          Navigator.of(context).pushAndRemoveUntil(
              MaterialPageRoute(builder: (BuildContext context) =&gt; MainPage()),
              (Route&lt;dynamic&gt; route) =&gt; false);
        }
      } else {
        setState(() {
          _isLoading = false;
        });
        Widget okButton = FlatButton(
            child: Text(&quot;OK&quot;),
            onPressed: () {
              Navigator.push(
                  context, MaterialPageRoute(builder: (context) =&gt; MainPage()));
            });
        setState(() {
          AlertDialog alert = AlertDialog(
            title: Text(&quot;Error message&quot;),
            content: Text(&quot;Oops! The password is wrong or the email is invalid.&quot;),
            actions: [
              okButton,
            ],
          );
          showDialog(
            context: context,
            builder: (BuildContext context) {
              return alert;
            },
          );
        });
        print(response.headers);
        print(response.body);
      }
    }
  </code></pre>