Skip to content

Comments

Revert "#167410: _initCalled completed twice (#9694)"#11084

Merged
auto-submit[bot] merged 5 commits intomainfrom
revert-9694-167410
Feb 20, 2026
Merged

Revert "#167410: _initCalled completed twice (#9694)"#11084
auto-submit[bot] merged 5 commits intomainfrom
revert-9694-167410

Conversation

@mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Feb 20, 2026

Reason for revert:

The PR being reverted (#9694) caused a bug in renderButton: flutter/flutter#182633

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reverts a previous change that caused a bug in renderButton. The changes include updating the CHANGELOG.md and pubspec.yaml to reflect the version revert, and modifying the google_sign_in_web.dart and its integration tests to remove the logic that threw an error when init was called multiple times. The _gisSdkClient is now initialized lazily, and a new _gisClient getter is introduced to ensure init has been called before accessing the GIS client.

Comment on lines +1 to +3
## 1.1.2

* Reverts "Throws a more actionable error when init is called more than once."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The changelog entry for version 1.1.2 correctly indicates the revert. This is in line with good release practices.

Comment on lines 68 to 70

await firstInit;
expect(plugin.initialized, completes);
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The removal of the tests for init being called twice is appropriate given the revert of the functionality that threw an error in such cases. The new expect(plugin.initialized, completes); correctly verifies the initialization.

Comment on lines +89 to +116
testWidgets('must be called for most of the API to work', (_) async {
expect(() async {
await plugin.attemptLightweightAuthentication(
const AttemptLightweightAuthenticationParameters(),
);
}, throwsStateError);

expect(() async {
await plugin.clientAuthorizationTokensForScopes(
const ClientAuthorizationTokensForScopesParameters(
request: AuthorizationRequestDetails(
scopes: <String>[],
userId: null,
email: null,
promptIfUnauthorized: false,
),
),
);
}, throwsStateError);

expect(() async {
await plugin.signOut(const SignOutParams());
}, throwsStateError);

expect(() async {
await plugin.disconnect(const DisconnectParams());
}, throwsStateError);
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The new test must be called for most of the API to work is a good addition. It ensures that methods requiring initialization will throw a StateError if init has not been called, which is crucial for correct API usage.

@visibleForTesting
StreamController<AuthenticationEvent>? debugAuthenticationController,
}) : _debugOverrideGisSdkClient = debugOverrideGisSdkClient,
}) : _gisSdkClient = debugOverrideGisSdkClient,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The change from _debugOverrideGisSdkClient to _gisSdkClient in the constructor initialization list is correct, as _gisSdkClient is now nullable and can be directly assigned the debug override.

/// times without awaiting.
bool _isInitCalled = false;
// A future that completes when the `init` call is done.
Completer<void>? _initCalled;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Changing _initCalled to a nullable Completer<void>? allows for its lazy initialization within the init method, which is a good pattern for ensuring it's only created when init is actually invoked.

final String? code = await _gisSdkClient.requestServerAuthCode(
params.request,
);
final String? code = await _gisClient.requestServerAuthCode(params.request);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consistent use of _gisClient ensures that requestServerAuthCode operations are performed only after the GIS client is safely accessed.

Comment on lines +250 to +251
await initialized;
return _gisClient.clearAuthorizationToken(params.accessToken);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consistent use of initialized and _gisClient ensures that clearAuthorizationToken operations are performed only after the plugin is properly initialized and the GIS client is safely accessed.

return FutureBuilder<void>(
key: Key(config.hashCode.toString()),
future: _initialized,
future: initialized,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The FutureBuilder now correctly uses the public initialized getter, which includes the necessary checks for plugin readiness.

viewType: 'gsi_login_button',
onElementCreated: (Object element) {
_gisSdkClient.renderButton(element, config);
_gisClient.renderButton(element, config);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using _gisClient here ensures that renderButton is called on a properly initialized GIS client, preventing potential runtime errors.

repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
version: 1.1.1
version: 1.1.2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The version number has been correctly updated to 1.1.2, reflecting the revert and new release.

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 20, 2026
@auto-submit auto-submit bot merged commit 673c2ac into main Feb 20, 2026
81 checks passed
@auto-submit auto-submit bot deleted the revert-9694-167410 branch February 20, 2026 20:07
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Feb 23, 2026
flutter/packages@9da22bf...12b43a1

2026-02-20 rick.hohler@gmail.com [webview_flutter_wkwebview] Fix crash
when calling setOnConsoleMessage multiple times (flutter/packages#10922)
2026-02-20 engine-flutter-autoroll@skia.org Manual roll Flutter from
c023e5b to 91b2d41 (31 revisions) (flutter/packages#11088)
2026-02-20 kallentu@google.com [rfw] Remove old TODOs for code block
languages. (flutter/packages#11080)
2026-02-20 matt.boetger@gmail.com [google_maps_flutter] Remove
usesCleartextTraffic (flutter/packages#11079)
2026-02-20 stuartmorgan@google.com [google_maps_flutter] Improve iOS
shared code validation (flutter/packages#11070)
2026-02-20 mdebbar@google.com Revert "#167410: _initCalled completed
twice (#9694)" (flutter/packages#11084)
2026-02-20 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump androidx.activity:activity from 1.12.2 to 1.12.4 in
/packages/image_picker/image_picker_android/android
(flutter/packages#11033)
2026-02-20 matt.boetger@gmail.com [interactive_media_ads] Remove
usesCleartextTraffic (flutter/packages#11065)
2026-02-19 matt.boetger@gmail.com [image_picker] Remove
usesCleartextTraffic (flutter/packages#11076)
2026-02-19 matt.boetger@gmail.com [quick_actions_android] Remove
deprecated usesCleartextTraffic (flutter/packages#11063)
2026-02-19 matt.boetger@gmail.com [quick_actions] Remove
usesCleartextTraffic (flutter/packages#11064)
2026-02-19 matt.boetger@gmail.com [google_maps_flutter_android] Remove
usesCleartextTraffic (flutter/packages#11078)
2026-02-19 louisehsu@google.com [google_maps_flutter_ios] Migrate to
UIScene (flutter/packages#11001)
2026-02-19 matt.boetger@gmail.com [image_picker_android] Remove
deprecated usesCleartextTraffic (flutter/packages#11059)
2026-02-19 matt.boetger@gmail.com [file_selector_android] Remove
deprecated usesCleartextTraffic (flutter/packages#11057)
2026-02-19 matt.boetger@gmail.com [webview_flutter_android] Remove
usesCleartextTraffic (flutter/packages#11066)
2026-02-19 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump exoplayer_version from 1.9.1 to 1.9.2 in
/packages/video_player/video_player_android/android
(flutter/packages#10985)
2026-02-19 stuartmorgan@google.com [google_maps_flutter] Fix add-marker
crash on Android (flutter/packages#11061)
2026-02-19 42980667+srivats22@users.noreply.github.com #167410:
_initCalled completed twice (flutter/packages#9694)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: google_sign_in platform-web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants