checkLoggedInState function

void checkLoggedInState()

Implementation

void checkLoggedInState() async {
  final userId = await const FlutterSecureStorage().read(key: "userId");
  if (userId != null) {
    final credentialState = await SignInWithApple.getCredentialState(userId);
    switch (credentialState) {
      case CredentialState.authorized:
        if (kDebugMode) {
          print("getCredentialState returned authorized");
        }
        break;
      case CredentialState.revoked:
        if (kDebugMode) {
          print("getCredentialState returned revoked");
        }
        break;
      case CredentialState.notFound:
        if (kDebugMode) {
          print("getCredentialState returned not found");
        }
        break;
    }
  }
}