I want to store an this Json response in shared preferences which contains one fields in it password and my response is
{
"id": 103,
"address": "ce5f4e2b82a901768456b0dfd58e7dfa99a1bd0e",
"privateKey": "91c8b3434a7eb8eb6df73cd7dfbfa3d7cce66d5f4f635fb6d329894c69fa0cab",
"status": "succeed",
"password": "1245687"
}
CodePudding user response:
final SharedPreferences prefs = await SharedPreferences.getInstance();
//Save the value
prefs.setString("json_response", json.encode(value));
//Read the value
var value = json.decode(prefs.getString(json_response))
CodePudding user response:
I have answered a similar question which answers to handling of json data with SharedPreferences in flutter
Refer the answer here