isLoggedIn static method

Future<bool> isLoggedIn()

Implementation

static Future<bool> isLoggedIn() async {
  try {
    if (!await storage.containsKey(key: 'email') || !await storage.containsKey(key: 'token')) return false;

    String email = (await storage.read(key: 'email'))!;
    String token = (await storage.read(key: 'token'))!;
    String accountId = (await storage.read(key: 'account_id'))!;

    if (email.isEmpty || token.isEmpty) return false;

    debugPrint('[DEBUG]: isLoggedIn E-Mail $email');
    debugPrint('[DEBUG]: isLoggedIn Token $token');
    debugPrint('[DEBUG]: isLoggedIn Account ID $accountId');

    return true;
  } catch (e) {
    debugPrint('[DEBUG]: isLoggedIn ERROR $e');
    return false;
  }
}