linkWithPopup method Null safety

Future<UserCredentialPlatform> linkWithPopup(
  1. AuthProvider provider

Links the user account with the given provider.

A FirebaseAuthException maybe thrown with the following error code:

  • provider-already-linked:
  • Thrown if the provider has already been linked to the user. This error is thrown even if this is not the same provider's account that is currently linked to the user.
  • invalid-credential:
  • Thrown if the provider's credential is not valid. This can happen if it has already expired when calling link, or if it used invalid token(s). See the Firebase documentation for your provider, and make sure you pass in the correct parameters to the credential method.
  • credential-already-in-use:
  • Thrown if the account corresponding to the credential already exists among your users, or is already linked to a Firebase User. For example, this error could be thrown if you are upgrading an anonymous user to a Google user by linking a Google credential to it and the Google credential used is already associated with an existing Firebase Google user. The fields email, phoneNumber, and credential (AuthCredential) may be provided, depending on the type of credential. You can recover from this error by signing in with credential directly via signInWithCredential.
  • email-already-in-use:
  • Thrown if the email corresponding to the credential already exists among your users. When thrown while linking a credential to an existing user, an email and credential (AuthCredential) fields are also provided. You have to link the credential to the existing user with that email if you wish to continue signing in with that credential. To do so, call fetchSignInMethodsForEmail, sign in to email via one of the providers returned and then User.linkWithCredential the original credential to that newly signed in user.
  • operation-not-allowed:
  • Thrown if you have not enabled the provider in the Firebase Console. Go to the Firebase Console for your project, in the Auth section and the Sign in Method tab and configure the provider.


Future<UserCredentialPlatform> linkWithPopup(AuthProvider provider) {
  throw UnimplementedError('linkWithPopup() is not implemented');