How to update a list in shared preferences ?
In Shared Preferences, we can also store a list in the form of a string. In the example below, a list of string data is stored in Shared Preferences as a string.
List data = ["3","4","5"];
storeData(data)async{
SharedPreferences sh= await SharedPreferences.getInstance();
sh.setString("newList",data.toString());// data store as a string
}
storeData(data);
If list of data update continuously but shared prefernces stored data not updated properly
sh.reload(); //After this perform logic to read data from Shared preferences
sh.getString("newList");// now every time list will be updated