flutter sharedpreferences clear

104

// You can simply use clear() function with your variable it
// will clear all the shared preferences.
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.clear();
// If you want to remove particular key value from
// share preferences with key name you can do it like this way as follows.
SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.remove('KeyNameHere');

Comments

Submit
0 Comments