Reputation: 2425
actually when saving data inside shared preferences.. I am using this code
add() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString('data', "ok");
}
but, is there a way to update the value of data
for example I want to change ok
into fine
because when I try to re-save my data using that code... and call it using prefs.getString('data');
it always shows the old data not the update one
Upvotes: 1
Views: 11558
Reputation: 2426
//shared-preferences
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString('profileImg', data1['imagePath']);
prefs.setString('un', data1['username']);
Upvotes: 0