logOut method

Future<bool> logOut()

Implementation

Future<bool> logOut() async {
  bool logOutSuccess = false;
  try {
    User? currentUser = await d2Instance.userModule.user.getOne();

    currentUser?.isLoggedIn = false;
    currentUser?.dirty = true;

    await d2Instance.userModule.user.setData(currentUser).save();

    logOutSuccess = true;
    await d2Instance.sharedPreferenceInstance.clear();
  } catch (e) {}
  return logOutSuccess;
}