Skip to content

[google_sign_in_web] _initCalled completed twice #167410

@jtmcdole

Description

@jtmcdole

While debugging the dashboard, I noticed Bad state: Future already completed. In initWithParams, the _initState variable is set but not captured locally. If initWithParams is called twice (my own bug), the completer gets overridden and then completed twice.

Potential solutions:

  • capture the completer; before completing, test if capture != _initState, complete or complete with an error.
  • initWithParams checks if _initState exists and awaits it before calling itself again

Meanwhile I'll still try to find out why our code is calling this twice...

stack:

Bad state: Future already completed
main.dart.mjs:59     at module0.Error._throwWithCurrentStackTrace (http://localhost:8080/main.dart.wasm:wasm-function[987]:0x178a1d)
    at module0._AsyncCompleter.complete (body) (http://localhost:8080/main.dart.wasm:wasm-function[984]:0x1789a1)
    at module0._AsyncCompleter.complete (unchecked entry) (http://localhost:8080/main.dart.wasm:wasm-function[1812]:0x188962)
    at module0.GoogleSignInPlugin.initWithParams inner (http://localhost:8080/main.dart.wasm:wasm-function[29305]:0x3a9d70)
    at module0._awaitHelper closure at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:104:5 (http://localhost:8080/main.dart.wasm:wasm-function[1903]:0x189ded)
    at module0.closure wrapper at org-dartlang-sdk:///dart-sdk/lib/_internal/wasm/lib/async_patch.dart:104:5 trampoline (http://localhost:8080/main.dart.wasm:wasm-function[1908]:0x189e87)
    at module0._RootZone.runUnary (http://localhost:8080/main.dart.wasm:wasm-function[1284]:0x17fc5a)
    at module0._FutureListener.handleValue (body) (http://localhost:8080/main.dart.wasm:wasm-function[1291]:0x17ff42)

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listgood first issueRelatively approachable for first-time contributorsp: google_sign_inThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions