init method

void init()

Implementation

void init() {
  _authStateSubscription =
      _supabaseService.client.auth.onAuthStateChange.listen((event) async {
    print("Auth state has changed!");
    User? user = await _authenticationService.fetchUser();

    if (user == null) {
      _dialogService.showDialog(
          BasicDialog(title: "Login failed", description: "Login failed"));
    } else if (!user.hasProfile) {
      print("Navigating to profile setup");
      _navigationService.navigateTo(Routes.profileSetup, clearHistory: true);
    } else {
      _navigationService.navigateTo(Routes.home, clearHistory: true);
    }
  });
}