Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

signInWithGoogle().whenComplete is triggered whether or not the login succeeds #8

Closed
pgainullin opened this issue Feb 27, 2020 · 7 comments

Comments

@pgainullin
Copy link

pgainullin commented Feb 27, 2020

which seems to be the expected behaviour of whenComplete:

"Registers a function to be called when this future completes.
The [action] function is called when this future completes, whether it does so with a value or with an error."

changing the signInWithGoogle() to return the user and then rewriting as follows seems to do the trick:

        signInWithGoogle().then((user) {
          if (user != null) {
            Navigator.of(context).push(
              MaterialPageRoute(
                builder: (context) {
                  return [...]();
                },
              ),
            );
          }

@daniele777
Copy link

daniele777 commented May 4, 2020

Where i can implement this part? i have this type of issue
Screenshot_20200504-113117

@pgainullin
Copy link
Author

signInWithGoogle().whenComplete(() {
<<this line

however your issue is potentially unrelated and could occur because the user metadata does not contain a picture URL (presumably triggered here -

)

@daniele777
Copy link

Same error i can't return in login screen with crediential of google accont.... idea?

@pgainullin
Copy link
Author

a bit hard to say especially not seeing the actual logs for the error (from the Run tab or Logcat).

try commenting out the whole section using Image.network here -

CircleAvatar(
backgroundImage: NetworkImage(
imageUrl,
),
radius: 60,
backgroundColor: Colors.transparent,
),

@daniele777
Copy link

daniele777 commented May 6, 2020

Authentication good i retrive link of my photo and name and email..but still have problem..

A non-null String must be provided to a Text widget.
'package:flutter/src/widgets/text.dart':
Failed assertion: line 285 pos 10: 'data != null'

@chrisbinsunny
Copy link

This problem still exists. I guess providing a FutureBuilder can solve the issue. If anyone knows how to solve this, please help.

@sbis04
Copy link
Owner

sbis04 commented Sep 6, 2020

I have fixed this issue. Please check out the latest master branch of this repo. Refer: ad503dc

Closing

@sbis04 sbis04 closed this as completed Sep 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants