0

I am new to flutter and using sample code that does signIn, I get the user, but I need to find if the user has previously used the App ( and then uninstalled) or using on a new device. I see another question that gets the AuthResult as shown below,

AuthResult authResult = await _auth.signInWithCredential(credential);
  if (authResult.additionalUserInfo.isNewUser) {
    //User logging in for the first time
    // Redirect user to tutorial 
  }
  else {
    //User has already logged in before.
    //Show user profile
  }

But the SignInScreen, does not return the authResult

SignInScreen(
        title: "Demo",
        header: new Padding(
          padding: const EdgeInsets.symmetric(vertical: 16.0),
          child: new Padding(
            padding: const EdgeInsets.all(16.0),
            child: new Text("Demo"),
          ),
        ),
        showBar: true,
        // horizontalPadding: 8,
        bottomPadding: 5,
        avoidBottomInset: true,
        color: Color(0xFF363636),
        providers: [
          ProvidersTypes.google,
          ProvidersTypes.phone,
          ProvidersTypes.facebook,
        //  ProvidersTypes.twitter,
        //  ProvidersTypes.email
        ],
        twitterConsumerKey: "",
        twitterConsumerSecret: "", horizontalPadding: 12,
      )

1 Answers1

0

From looking at the code, it looks like the firebase-ui-flutter library that you're using does not expose the user from the active sign-in operation (calls to signInWith...).

You'll either have to update the library to expose the functionality, write your own sign-in UI, or find another library that handles it better. You could also file a bug on the repo, but it's seen very little maintenance in the past two years. There's a fork that seems more update, but that code also doesn't expose the result from active sign-in.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • thanks, Is there a concept of 3rd party libraries and original( i.e Google's official) libraries in Flutter and if there is any original library that does the task of Login/Registration or any example that you can point to ? –  Dec 29 '19 at 22:47