ListTile(
iconColor: Colors.white,
textColor: Colors.white,
leading: Icon(Icons.logout_outlined),
title: Text("Logout"),
onTap: () {
CoolAlert.show(
context: context,
type: CoolAlertType.confirm,
title: 'Logout',
text: 'Are you sure you want to logout?',
confirmBtnText: 'Yes',
confirmBtnColor: Colors.red,
cancelBtnText: 'No',
closeOnConfirmBtnTap: true,
onConfirmBtnTap: () async {
_prefs.setString(Prefs.adminUser, '');
_prefs.setBool(Prefs.isLoggedIn, false);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => Login()));
});
},
)
Above is the code snippet from my app. When the 'Yes' button is clicked, it erases the SharedPreference data, but not navigates to the Login Screen. Why?
Above is the code snippet from my app. When the 'Yes' button is clicked, it erases the SharedPreference data, but not navigates to the Login Screen. Why?