Issue
I want to save my login details when I click remember me button. and next time I login in to the system I don't want to add details again. how can I do this. You can find my login screen full code from here. all the API integrations are completed. login full code
remberMeCheckBox() {
return CheckboxListTile(
checkColor: textGrey,
activeColor: textGrey,
value: false,
onChanged: (value) {},
controlAffinity: ListTileControlAffinity.leading,
contentPadding: EdgeInsets.only(left: 0, top: 0),
title: Text(
"Remember Me",
style: TextStyle(color: textGrey, fontFamily: "Dubai", fontSize: 14),
),
);
}
Solution
You can use a package named shared_preferences
. If you want to save the data just use
SharedPreferences prefs = await SharePreferences.getInstance();
prefs.setString("yourKeyForStringHere",yourStringHere);
After that it will store your values in local storage if you want to extract it just type
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.getString("yourKeyForStringHere");
You can set it for every data type like int string bool aur lists etc.
Answered By - Usama majid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.