setInitialScreen method

Future<void> setInitialScreen(
  1. User? user
)

Setting initial screen This method checks if the user is authenticated and whether their email is verified. Parameter user is the current Firebase user. If the user is authenticated and their email is verified, it navigates to the Dashboard.

Implementation

Future<void> setInitialScreen(User? user) async {
  if (user != null) {

    user.emailVerified ? Get.offAll(() => const Dashboard(initialIndex: 1,)) : Get.offAll(() => const MailVerification());
  } else {
    // Check if it's the user's first time, then navigate accordingly
    userStorage.writeIfNull('isFirstTime', true);
    // Remove the splash screen
    userStorage.read('isFirstTime') != true
        ? Get.offAll(() => const WelcomeScreen())
        : Get.offAll(() => const OnBoardingScreen());
  }
}