I am using the getx package in my application and there is something I am wondering about. Is it possible to reset all states of my app using getx? So it's kind of like a restart.
I am using the getx package in my application and there is something I am wondering about. Is it possible to reset all states of my app using getx? So it's kind of like a restart.
Future<void> logoutUser() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.clear(); //clearing my token data
await Get.deleteAll(force: true); //deleting all controllers
Phoenix.rebirth(Get.context!); // Restarting app
Get.reset(); // resetting getx
}
used flutter_phoenix library to resart the app.
Deleted all controllers using Get.deleteAll(force: true);
Works like a charm for me.