-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[google_sign_in_web] _initCalled completed twice #167410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can confirm, as far as it helps, here is my stacktrace.
Code, using @RoutePage()
class SigninPage extends StatelessWidget {
const SigninPage({super.key});
@override
Widget build(BuildContext context) {
print('SigninPage build');
return AuthStateListener<OAuthController>(
child: OAuthProviderButton(
provider: GoogleProvider(clientId: Common.googleClientId),
),
listener: (oldState, newState, ctrl) {
if (newState is SignedIn) {
Navigator.pushReplacementNamed(context, '/');
}
return null;
},
);
}
} To reproduce
Sidenotes |
@jtmcdole are you still looking into this issue? |
@mdebbar - I'm not actively looking into this; I filed the bug so it wouldn't get lost. I also have problems with this plugin which cannot tell that the pop up hasn't closed and thus cannot sign in. |
In packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart:173-175, the following has been working so far for me. if (!_initCalled!.isCompleted) {
_initCalled!.complete(); // Signal that `init` is fully done.
} This solves the error, but not the root cause, although the latter seems to be a bit out of (project) scope. |
While debugging the dashboard, I noticed
Bad state: Future already completed
. IninitWithParams
, the_initState
variable is set but not captured locally. IfinitWithParams
is called twice (my own bug), the completer gets overridden and then completed twice.Potential solutions:
Meanwhile I'll still try to find out why our code is calling this twice...
stack:
The text was updated successfully, but these errors were encountered: