Flutter How to check whether the user sign up with google provider before?

Solution 1:

You can use the pre-built method "isNewUser" of the "UserCredential" class. Call the sing in with credentials function from a variable and use said variable to perform the check.

...
var result =
        await FirebaseAuth.instance.signInWithCredential(credential);

   if (result.additionalUserInfo!.isNewUser) {

// Perform what you need to do for new users here
// like creating a user document

      }else {

         //Perform what you want to do for old users here
         //like fetching a specific user document

}
...