[google_sign_in_web] Update web package analysis options (#4875)

diff --git a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md
index e65ce0f..c1a1606 100644
--- a/packages/google_sign_in/google_sign_in_web/CHANGELOG.md
+++ b/packages/google_sign_in/google_sign_in_web/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.10.0+5
+
+* Internal code cleanup for stricter analysis options.
+
 ## 0.10.0+4
 
 * Removes dependency on `meta`.
diff --git a/packages/google_sign_in/google_sign_in_web/analysis_options.yaml b/packages/google_sign_in/google_sign_in_web/analysis_options.yaml
deleted file mode 100644
index 5aeb4e7..0000000
--- a/packages/google_sign_in/google_sign_in_web/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../../analysis_options_legacy.yaml
diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/auth2_test.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/auth2_test.dart
index e1a97ce..2af9476 100644
--- a/packages/google_sign_in/google_sign_in_web/example/integration_test/auth2_test.dart
+++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/auth2_test.dart
@@ -15,10 +15,10 @@
 void main() {
   IntegrationTestWidgetsFlutterBinding.ensureInitialized();
 
-  GoogleSignInTokenData expectedTokenData =
+  final GoogleSignInTokenData expectedTokenData =
       GoogleSignInTokenData(idToken: '70k3n', accessToken: 'access_70k3n');
 
-  GoogleSignInUserData expectedUserData = GoogleSignInUserData(
+  final GoogleSignInUserData expectedUserData = GoogleSignInUserData(
     displayName: 'Foo Bar',
     email: 'foo@example.com',
     id: '123',
@@ -55,7 +55,7 @@
         );
         fail('plugin.init should have thrown an exception!');
       } catch (e) {
-        final String code = js_util.getProperty(e, 'code') as String;
+        final String code = js_util.getProperty<String>(e, 'code');
         expect(code, 'idpiframe_initialization_failed');
       }
     });
@@ -99,7 +99,7 @@
     });
     testWidgets('requestScopes', (WidgetTester tester) async {
       await _discardInit();
-      await expectLater(plugin.requestScopes(['newScope']),
+      await expectLater(plugin.requestScopes(<String>['newScope']),
           throwsA(isA<PlatformException>()));
     });
   });
@@ -137,26 +137,28 @@
       });
 
       testWidgets('signInSilently', (WidgetTester tester) async {
-        GoogleSignInUserData actualUser = (await plugin.signInSilently())!;
+        final GoogleSignInUserData actualUser =
+            (await plugin.signInSilently())!;
 
         expect(actualUser, expectedUserData);
       });
 
       testWidgets('signIn', (WidgetTester tester) async {
-        GoogleSignInUserData actualUser = (await plugin.signIn())!;
+        final GoogleSignInUserData actualUser = (await plugin.signIn())!;
 
         expect(actualUser, expectedUserData);
       });
 
       testWidgets('getTokens', (WidgetTester tester) async {
-        GoogleSignInTokenData actualToken =
+        final GoogleSignInTokenData actualToken =
             await plugin.getTokens(email: expectedUserData.email);
 
         expect(actualToken, expectedTokenData);
       });
 
       testWidgets('requestScopes', (WidgetTester tester) async {
-        bool scopeGranted = await plugin.requestScopes(['newScope']);
+        final bool scopeGranted =
+            await plugin.requestScopes(<String>['newScope']);
 
         expect(scopeGranted, isTrue);
       });
@@ -187,7 +189,7 @@
         await plugin.signIn();
         fail('plugin.signIn() should have thrown an exception!');
       } catch (e) {
-        final String code = js_util.getProperty(e, 'code') as String;
+        final String code = js_util.getProperty<String>(e, 'code');
         expect(code, 'popup_closed_by_user');
       }
     });
diff --git a/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_mocks/src/auth2_init.dart b/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_mocks/src/auth2_init.dart
index 2a085cc..cc49b27 100644
--- a/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_mocks/src/auth2_init.dart
+++ b/packages/google_sign_in/google_sign_in_web/example/integration_test/gapi_mocks/src/auth2_init.dart
@@ -95,7 +95,7 @@
       return new Promise((resolve, reject) => {
         window.setTimeout(() => {
           reject({
-            error: '${error}'
+            error: '$error'
           });
         }, 30);
       });
diff --git a/packages/google_sign_in/google_sign_in_web/example/lib/main.dart b/packages/google_sign_in/google_sign_in_web/example/lib/main.dart
index 1041520..d381fb4 100644
--- a/packages/google_sign_in/google_sign_in_web/example/lib/main.dart
+++ b/packages/google_sign_in/google_sign_in_web/example/lib/main.dart
@@ -17,6 +17,6 @@
 class _MyAppState extends State<MyApp> {
   @override
   Widget build(BuildContext context) {
-    return Text('Testing... Look at the console output for results!');
+    return const Text('Testing... Look at the console output for results!');
   }
 }
diff --git a/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml
index e370ecc..5a51cd5 100644
--- a/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in_web/example/pubspec.yaml
@@ -12,11 +12,11 @@
     path: ../
 
 dev_dependencies:
-  http: ^0.13.0
-  js: ^0.6.3
   flutter_driver:
     sdk: flutter
   flutter_test:
     sdk: flutter
+  http: ^0.13.0
   integration_test:
     sdk: flutter
+  js: ^0.6.3
diff --git a/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart b/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
index ff0d8e4..731ced5 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart
@@ -55,7 +55,7 @@
   @visibleForTesting
   Future<void> get initialized {
     _assertIsInitCalled();
-    return Future.wait([_isGapiInitialized, _isAuthInitialized]);
+    return Future.wait(<Future<void>>[_isGapiInitialized, _isAuthInitialized]);
   }
 
   String? _autoDetectedClientId;
@@ -94,14 +94,14 @@
       client_id: appClientId!,
     ));
 
-    Completer<void> isAuthInitialized = Completer<void>();
+    final Completer<void> isAuthInitialized = Completer<void>();
     _isAuthInitialized = isAuthInitialized.future;
     _isInitCalled = true;
 
     auth.then(allowInterop((auth2.GoogleAuth initializedAuth) {
       // onSuccess
 
-      // TODO: https://github.com/flutter/flutter/issues/48528
+      // TODO(ditman): https://github.com/flutter/flutter/issues/48528
       // This plugin doesn't notify the app of external changes to the
       // state of the authentication, i.e: if you logout elsewhere...
 
@@ -124,7 +124,7 @@
     await initialized;
 
     return gapiUserToPluginUserData(
-        await auth2.getAuthInstance()?.currentUser?.get());
+        auth2.getAuthInstance()?.currentUser?.get());
   }
 
   @override
@@ -169,7 +169,9 @@
     final auth2.GoogleUser? currentUser =
         auth2.getAuthInstance()?.currentUser?.get();
 
-    if (currentUser == null) return;
+    if (currentUser == null) {
+      return;
+    }
 
     return currentUser.disconnect();
   }
@@ -181,7 +183,9 @@
     final auth2.GoogleUser? currentUser =
         auth2.getAuthInstance()?.currentUser?.get();
 
-    if (currentUser == null) return false;
+    if (currentUser == null) {
+      return false;
+    }
 
     return currentUser.isSignedIn();
   }
@@ -197,17 +201,22 @@
   Future<bool> requestScopes(List<String> scopes) async {
     await initialized;
 
-    final currentUser = auth2.getAuthInstance()?.currentUser?.get();
+    final auth2.GoogleUser? currentUser =
+        auth2.getAuthInstance()?.currentUser?.get();
 
-    if (currentUser == null) return false;
+    if (currentUser == null) {
+      return false;
+    }
 
-    final grantedScopes = currentUser.getGrantedScopes() ?? '';
-    final missingScopes =
-        scopes.where((scope) => !grantedScopes.contains(scope));
+    final String grantedScopes = currentUser.getGrantedScopes() ?? '';
+    final Iterable<String> missingScopes =
+        scopes.where((String scope) => !grantedScopes.contains(scope));
 
-    if (missingScopes.isEmpty) return true;
+    if (missingScopes.isEmpty) {
+      return true;
+    }
 
-    final response = await currentUser
+    final Object? response = await currentUser
         .grant(auth2.SigninOptions(scope: missingScopes.join(' ')));
 
     return response != null;
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart b/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart
index 1e2db0f..a6d5b9d 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapi.dart
@@ -10,7 +10,7 @@
 
 // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi
 
-// ignore_for_file: public_member_api_docs, unused_element
+// ignore_for_file: public_member_api_docs, unused_element, sort_constructors_first, prefer_generic_function_type_aliases
 
 @JS()
 library gapi;
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart b/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart
index d5efc71..88d196b 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart
@@ -12,7 +12,7 @@
 
 // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gapi.auth2
 
-// ignore_for_file: public_member_api_docs, unused_element
+// ignore_for_file: public_member_api_docs, unused_element, non_constant_identifier_names, sort_constructors_first, always_specify_types
 
 @JS()
 library gapiauth2;
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart b/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart
index 621e167..f60d6cd 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/load_gapi.dart
@@ -7,8 +7,8 @@
 
 import 'dart:async';
 
-import 'package:js/js.dart';
 import 'package:flutter/foundation.dart' show visibleForTesting;
+import 'package:js/js.dart';
 
 import 'generated/gapi.dart' as gapi;
 import 'utils.dart' show injectJSLibraries;
@@ -37,8 +37,10 @@
   });
 
   // Attach the onload callback to the main url
-  final List<String> allLibraries = <String>[_addOnloadToScript(url)]
-    ..addAll(libraries);
+  final List<String> allLibraries = <String>[
+    _addOnloadToScript(url),
+    ...libraries
+  ];
 
   return Future.wait(
       <Future<void>>[injectJSLibraries(allLibraries), gapiOnLoad.future]);
diff --git a/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart b/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart
index bcfefc2..cae20d2 100644
--- a/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart
+++ b/packages/google_sign_in/google_sign_in_web/lib/src/utils.dart
@@ -25,15 +25,15 @@
 
   final html.Element targetElement = target ?? html.querySelector('head')!;
 
-  libraries.forEach((String library) {
+  for (final String library in libraries) {
     final html.ScriptElement script = html.ScriptElement()
       ..async = true
       ..defer = true
       ..src = library;
-    // TODO add a timeout race to fail this future
+    // TODO(ditman): add a timeout race to fail this future
     loading.add(script.onLoad.first);
     tags.add(script);
-  });
+  }
 
   targetElement.children.addAll(tags);
   return Future.wait(loading);
diff --git a/packages/google_sign_in/google_sign_in_web/pubspec.yaml b/packages/google_sign_in/google_sign_in_web/pubspec.yaml
index 2f033d9..3bc05d1 100644
--- a/packages/google_sign_in/google_sign_in_web/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in_web/pubspec.yaml
@@ -3,7 +3,7 @@
   for signing in with a Google account on Android, iOS and Web.
 repository: https://github.com/flutter/plugins/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: 0.10.0+4
+version: 0.10.0+5
 
 environment:
   sdk: ">=2.12.0 <3.0.0"
@@ -24,7 +24,6 @@
     sdk: flutter
   google_sign_in_platform_interface: ^2.0.0
   js: ^0.6.3
-  pedantic: ^1.10.0
 
 dev_dependencies:
   flutter_test:
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index 0022bee..0e8e1cb 100644
--- a/script/configs/custom_analysis.yaml
+++ b/script/configs/custom_analysis.yaml
@@ -15,7 +15,6 @@
 - google_maps_flutter/google_maps_flutter_platform_interface
 - google_maps_flutter/google_maps_flutter_web
 - google_sign_in/google_sign_in
-- google_sign_in/google_sign_in_web
 - in_app_purchase/in_app_purchase
 - in_app_purchase/in_app_purchase_android
 - in_app_purchase/in_app_purchase_storekit