signInWithApple method

Future<void> signInWithApple()

Implementation

Future<void> signInWithApple() async {
  try {
    final AuthorizationCredentialAppleID credential =
        await SignInWithApple.getAppleIDCredential(
      scopes: [
        AppleIDAuthorizationScopes.email,
        AppleIDAuthorizationScopes.fullName,
      ],
      // Provide your own nonce here.
      nonce: 'nonce',
    );

    if (credential.email == null) {
      debugPrint('No email associated with this Apple ID.');
    }

    // Use the appleIdToken, email, and fullName to sign in or create a new account.
    if (await AuthRepository().appleLogin(credential)) {
      Get.offAllNamed(ERoutes.HOME);
    }
  } on PlatformException catch (error) {
    debugPrint(error.message);
  }
}