main function

Future<void> main()

Implementation

Future<void> main() async {


  final binding = WidgetsFlutterBinding.ensureInitialized();

  binding.addPostFrameCallback((_) async {
    BuildContext context = binding.rootElement!;
    precacheImage(AssetImage(white_shape_logo), context);
  });
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  ).then((value) {
    if (kReleaseMode) {
      FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
    }
  });

  passwordLengthGlobal = 8;
  appButtonBackgroundColorGlobal = primaryColor;
  defaultAppButtonTextColorGlobal = whiteColor;
  defaultRadius = 12;
  defaultBlurRadius = 0;
  defaultSpreadRadius = 0;
  textPrimaryColorGlobal = more_dark_Color;
  textSecondaryColorGlobal = appTextSecondaryColor;
  defaultAppButtonElevation = 0;
  pageRouteTransitionDurationGlobal = 400.milliseconds;
  textBoldSizeGlobal = 14;
  textPrimarySizeGlobal = 14;
  textSecondarySizeGlobal = 12;
  await initialize();
  localeLanguageList = languageList();

  await SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
  ]);

  await appStore.setLoggedIn(getBoolAsync(IS_LOGGED_IN), isInitializing: true);
  await appStore.setGuestUser(getBoolAsync(IS_GUEST_USER), isInitializing: true);
  appStore.setDarkMode(false);

  await appStore.setUseMaterialYouTheme(getBoolAsync(USE_MATERIAL_YOU_THEME), isInitializing: true);

  if (appStore.isLoggedIn) {
    await appStore.setUserId(getIntAsync(USER_ID), isInitializing: true);
    await appStore.setFirstName(getStringAsync(FIRST_NAME), isInitializing: true);
    await appStore.setLastName(getStringAsync(LAST_NAME), isInitializing: true);
    await appStore.setUserEmail(getStringAsync(USER_EMAIL), isInitializing: true);
    await appStore.setUserName(getStringAsync(USERNAME), isInitializing: true);
    await appStore.setDisplayName(getStringAsync(DISPLAY_NAME), isInitializing: true);
    await appStore.setHomeTown(getStringAsync(HOMETOWN), isInitializing: true);

    await appStore.setHomeTownLatitude(getDoubleAsync(LATITUDE), isInitializing: true);
    await appStore.setHomeTownLongitude(getDoubleAsync(LONGITUDE), isInitializing: true);
    await appStore.setContactNumber(getStringAsync(CONTACT_NUMBER), isInitializing: true);
    await appStore.setUserProfile(getStringAsync(PROFILE_IMAGE), isInitializing: true);
    await appStore.setCountry(getStringAsync(COUNTRY), isInitializing: true);
    await appStore.setState(getStringAsync(STATE), isInitializing: true);
    await appStore.setCity(getStringAsync(COUNTRY), isInitializing: true);
    await appStore.setToken(getStringAsync(TOKEN), isInitializing: true);
    await appStore.setAddress(getStringAsync(ADDRESS), isInitializing: true);
    await appStore.setAboutMeDescription(getStringAsync(ABOUT_ME), isInitializing: true);
    await appStore.setGender(getStringAsync(GENDER), isInitializing: true);
    await appStore.setRelationShipStatus(getStringAsync(RELATIONSHIP_STATUS), isInitializing: true);
    await appStore.setLoginType(getStringAsync(LOGIN_TYPE), isInitializing: true);
    await appStore.setAccountType(getStringAsync(ACCOUNT_TYPE), isInitializing: true);
    await appStore.setUserType(getStringAsync(USER_TYPE), isInitializing: true);
    await appStore.setDob(getStringAsync(DOB), isInitializing: true);
    await appStore.setTotalReview(getIntAsync(TOTAL_REVIEW), isInitializing: true);
    await appStore.setFollowers(getIntAsync(FOLLOWERS), isInitializing: true);
    await appStore.setFollowing(getIntAsync(FOLLOWING), isInitializing: true);
    await appStore.setCreatedAt(getStringAsync(CREATED_AT), isInitializing: true);
    await appStore.setIsOnline(getStringAsync(IS_ONLINE), isInitializing: true);
    await appStore.setIsPrivateAccount(getStringAsync(IS_PRIVATE_ACCOUNT), isInitializing: true);

    await appStore.setDontAllowsToOtherWatchMyEvent(getStringAsync(DONT_ALLOW_OTHERS_TO_WATCH_MY_EVENT), isInitializing: true);

    await appStore.setNotifyMeOfNewListingNearBy(getStringAsync(NOTIFY_ME_OF_NEW_LISTING_NEAR_BY), isInitializing: true);

    await appStore.setMessagePhotosLikesNewFans(getStringAsync(MESSAGE_PHOTOS_LIKES_NEW_THINGS), isInitializing: true);

    await appStore.setHideFromSearch(getStringAsync(HIDE_FROM_SEARCH), isInitializing: true);
    await appStore.setHideEvents(getStringAsync(HIDE_EVENTS), isInitializing: true);
    await appStore.setMsgOff(getStringAsync(MSG_OFF), isInitializing: true);
    await appStore.setInstagramLink(getStringAsync(INSTAGRAM_LINK), isInitializing: true);
    await appStore.setTikTokLink(getStringAsync(TIKTOK_LINK), isInitializing: true);
    await appStore.setSpotifyLink(getStringAsync(SPOTIFY_LINK), isInitializing: true);
    await appStore.setTwitterLink(getStringAsync(TWITTER_LINK), isInitializing: true);
    await appStore.setCurrentPassword(getStringAsync(CURRENT_PASSWORD), isInitializing: true);
    await appStore.setIsProUser(getBoolAsync(IS_PRO_USER), isInitializing: true);
    await appStore.setTotalClaimBusiness(getIntAsync(TOTAL_CLAIM_BUSINESS), isInitializing: true);

    List<String>? mList = sharedPreferences.getStringList(MUSIC_TYPE_ID) ?? [];
    List<int> musicList = mList.map((i) => int.parse(i)).toList();
    await appStore.setMusicAffinityList(musicList, isInitializing: true);

    List<String>? iList = sharedPreferences.getStringList(INTEREST_TYPE_ID) ?? [];
    List<int> interestList = iList.map((i) => int.parse(i)).toList();
    await appStore.setInterestList(interestList, isInitializing: true);

  }

  runApp(const MyApp());
}