handleLogout method
Implementation
Future<bool?> handleLogout(BuildContext context,
{bool? noCallApi, bool? clearcache}) async {
// Preferences.setid("");
// Preferences.setidMed("");
// Preferences.setPassword("");
// Preferences.setSignWith("non");
// Preferences.getSignWith();
// Preferences.setLatLong("");
// Preferences.setProfile("");
Config.isCheckVerifAgain = false;
Config.loginWith = LoginWith.nonLogin;
_googleSignIn.disconnect();
// FacebookAuth.instance.logOut();
// plugin.logOut();
try {
await _googleSignIn.signOut().then((value) {});
} catch (error) {
print(error);
}
// FacebookLogin().logOut();
// plugin.logOut();
Preferences.getApises().then((value) {
if (value != null || value != "") {
if (noCallApi == null) {
callApiLogout(context, clearcache: clearcache).then((value){
if (value != null && value){
return true;
}
});
} else {
Preferences.clearChace();
Future.delayed(Duration(seconds: 1)).then((value) {
return true;
// go first
// SellonRouter.makeFirst(context, SplashSellonScreen());
});
}
} else {
Future.delayed(Duration(seconds: 1)).then((value) {
return true;
// go first
// SellonRouter.makeFirst(context, SplashSellonScreen());
});
}
});
}