I'm using shared preferences to store the current user's name, avatar, and a boolean for whether the user is logged in. Uninstalling the app seems to lead to a problem when re-installing. It appears related to shared preferences
because when I log out and log back in the problem goes away. I suspect the shared preferences file is corrupted somehow and this triggers problems all over my app.
So is there a way I can either clear or delete the shared preferences file upon uninstall?
If it helps, here's the code for logging out;
Future<void> logOutSocial() async {
try {
socState();
await socialLogin.logOutFacebook();
await socialLogin.logOutGoogle();
await socialLogin.logOutTwitter();
currentname = "Anonymous";
currentavatar = "https://example.com/default.jpg";
currentlogged = false;
currentuserid = "0";
await savePreferences(
currentname: "Anonymous",
currentavatar: "https://example.com/default.jpg",
currentlogged: false,
);
notifyListeners();
} catch (e) {
print(e);
}
}