clearPreferences function

Future<void> clearPreferences()

Implementation

Future<void> clearPreferences() async {
  if (appStore.isLoggedIn) {
    OneSignal.Notifications.clearAll();
    OneSignal.logout();
    isOneSignalInitialize = false;
  }
  await appStore.setLoggedIn(false);
  await appStore.setGuestUser(false);
  await appStore.setToken('');
  await appStore.setUserId(0);
  await appStore.setFirstName('');
  await appStore.setLastName('');
  await appStore.setUserEmail('');
  await appStore.setUserName('');
  await appStore.setDisplayName('');
  await appStore.setHomeTown('');
  await appStore.setLatitude(0.0);
  await appStore.setLongitude(0.0);
  await appStore.setHomeTownLatitude(0.0);
  await appStore.setHomeTownLongitude(0.0);
  await appStore.setAddress('');
  await appStore.setAboutMeDescription('');
  await appStore.setGender('');
  await appStore.setRelationShipStatus('');
  await appStore.setCountry('');
  await appStore.setState('');
  await appStore.setCity('');
  await appStore.setPlayerId('');
  await appStore.setContactNumber('');
  await appStore.setAccountType('');
  await appStore.setUserType('');
  await appStore.setDob('');
  await appStore.setTotalReview(0);
  await appStore.setFollowers(0);
  await appStore.setFollowing(0);
  await appStore.setCreatedAt('');
  await appStore.setIsOnline('');
  await appStore.setIsPrivateAccount('');
  await appStore.setHideEvents('');
  await appStore.setHideFromSearch('');
  await appStore.setMsgOff('');
  await appStore.setInstagramLink('');
  await appStore.setTikTokLink('');
  await appStore.setSpotifyLink('');
  await appStore.setTwitterLink('');
  await appStore.setBusinessId([]);
  await appStore.setLoginType('');
  await appStore.setUserProfile('');
  await appStore.setMusicAffinityList([]);
  await appStore.setInterestList([]);
  await appStore.setCurrentPassword('');
  await appStore.setLocationPermission(false);
  await appStore.setIsProUser(false);
  await appStore.setTotalClaimBusiness(0);
  appStore.setOtpCode('');

  await removeKey(LOGIN_TYPE);
  await removeKey(SELECTED_BUSINESS_ID);

  //clear global variable data
  // listCities = [];
  // eventCities = [];
  appStore.eventFeedResponse = EventFeedResponse();
}