isLoggedIn function

Future<bool> isLoggedIn()

Checks if the user is currently logged in

Returns true if the user has a valid WebID and is logged in, false otherwise. This function should be used before accessing any pod data that requires authentication.

Implementation

Future<bool> isLoggedIn() async {
  try {
    // Check for a WebID.

    final webId = await getWebId();
    if (webId == null || webId.isEmpty) {
      //debugPrint('⚠️ No WebID found, user is not logged in');
      return false;
    }

    // Check if the user is logged in.

    final loggedIn = await checkLoggedIn();

    return loggedIn;
  } catch (e) {
    //debugPrint('⚠️ Error checking login status: $e');
    return false;
  }
}