import 'package:Stocky/services/local/StorageService.dart'; import 'package:get/get.dart'; class SplashScreenController extends GetxController { late Future _authCheck; @override void onInit() { super.onInit(); _authCheck = _checkAuthentication(); } Future _checkAuthentication() async { final LocalStorageService settings = Get.find(); final accessToken = settings.getAccessToken(); if (accessToken != null && accessToken.isNotEmpty) { return true; } return false; } Future navigateBasedOnAuth() async { final isAuthenticated = await _authCheck; if (isAuthenticated) { Get.offAllNamed('/home'); } else { Get.offAllNamed('/login'); } } }