[google_sign_in] Update app-facing package analysis options (#4881)

diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md
index 183edad..a46023b 100644
--- a/packages/google_sign_in/google_sign_in/CHANGELOG.md
+++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 5.2.4
+
+* Internal code cleanup for stricter analysis options.
+
 ## 5.2.3
 
 * Bumps the Android dependency on `com.google.android.gms:play-services-auth` and therefore removes the need for `jetifier`.
diff --git a/packages/google_sign_in/google_sign_in/analysis_options.yaml b/packages/google_sign_in/google_sign_in/analysis_options.yaml
deleted file mode 100644
index 5aeb4e7..0000000
--- a/packages/google_sign_in/google_sign_in/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../../analysis_options_legacy.yaml
diff --git a/packages/google_sign_in/google_sign_in/example/integration_test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/example/integration_test/google_sign_in_test.dart
index 7a15223..be3cc89 100644
--- a/packages/google_sign_in/google_sign_in/example/integration_test/google_sign_in_test.dart
+++ b/packages/google_sign_in/google_sign_in/example/integration_test/google_sign_in_test.dart
@@ -4,15 +4,15 @@
 
 // @dart = 2.9
 
-import 'package:integration_test/integration_test.dart';
 import 'package:flutter_test/flutter_test.dart';
 import 'package:google_sign_in/google_sign_in.dart';
+import 'package:integration_test/integration_test.dart';
 
 void main() {
   IntegrationTestWidgetsFlutterBinding.ensureInitialized();
 
   testWidgets('Can initialize the plugin', (WidgetTester tester) async {
-    GoogleSignIn signIn = GoogleSignIn();
+    final GoogleSignIn signIn = GoogleSignIn();
     expect(signIn, isNotNull);
   });
 }
diff --git a/packages/google_sign_in/google_sign_in/example/lib/main.dart b/packages/google_sign_in/google_sign_in/example/lib/main.dart
index c677d4e..9840a1e 100644
--- a/packages/google_sign_in/google_sign_in/example/lib/main.dart
+++ b/packages/google_sign_in/google_sign_in/example/lib/main.dart
@@ -7,9 +7,9 @@
 import 'dart:async';
 import 'dart:convert' show json;
 
-import "package:http/http.dart" as http;
 import 'package:flutter/material.dart';
 import 'package:google_sign_in/google_sign_in.dart';
+import 'package:http/http.dart' as http;
 
 GoogleSignIn _googleSignIn = GoogleSignIn(
   // Optional clientId
@@ -54,7 +54,7 @@
 
   Future<void> _handleGetContact(GoogleSignInAccount user) async {
     setState(() {
-      _contactText = "Loading contact info...";
+      _contactText = 'Loading contact info...';
     });
     final http.Response response = await http.get(
       Uri.parse('https://people.googleapis.com/v1/people/me/connections'
@@ -63,36 +63,37 @@
     );
     if (response.statusCode != 200) {
       setState(() {
-        _contactText = "People API gave a ${response.statusCode} "
-            "response. Check logs for details.";
+        _contactText = 'People API gave a ${response.statusCode} '
+            'response. Check logs for details.';
       });
       print('People API ${response.statusCode} response: ${response.body}');
       return;
     }
-    final Map<String, dynamic> data = json.decode(response.body);
+    final Map<String, dynamic> data =
+        json.decode(response.body) as Map<String, dynamic>;
     final String? namedContact = _pickFirstNamedContact(data);
     setState(() {
       if (namedContact != null) {
-        _contactText = "I see you know $namedContact!";
+        _contactText = 'I see you know $namedContact!';
       } else {
-        _contactText = "No contacts to display.";
+        _contactText = 'No contacts to display.';
       }
     });
   }
 
   String? _pickFirstNamedContact(Map<String, dynamic> data) {
-    final List<dynamic>? connections = data['connections'];
+    final List<dynamic>? connections = data['connections'] as List<dynamic>?;
     final Map<String, dynamic>? contact = connections?.firstWhere(
       (dynamic contact) => contact['names'] != null,
       orElse: () => null,
-    );
+    ) as Map<String, dynamic>?;
     if (contact != null) {
       final Map<String, dynamic>? name = contact['names'].firstWhere(
         (dynamic name) => name['displayName'] != null,
         orElse: () => null,
-      );
+      ) as Map<String, dynamic>?;
       if (name != null) {
-        return name['displayName'];
+        return name['displayName'] as String?;
       }
     }
     return null;
@@ -109,7 +110,7 @@
   Future<void> _handleSignOut() => _googleSignIn.disconnect();
 
   Widget _buildBody() {
-    GoogleSignInAccount? user = _currentUser;
+    final GoogleSignInAccount? user = _currentUser;
     if (user != null) {
       return Column(
         mainAxisAlignment: MainAxisAlignment.spaceAround,
@@ -121,7 +122,7 @@
             title: Text(user.displayName ?? ''),
             subtitle: Text(user.email),
           ),
-          const Text("Signed in successfully."),
+          const Text('Signed in successfully.'),
           Text(_contactText),
           ElevatedButton(
             child: const Text('SIGN OUT'),
@@ -137,7 +138,7 @@
       return Column(
         mainAxisAlignment: MainAxisAlignment.spaceAround,
         children: <Widget>[
-          const Text("You are not currently signed in."),
+          const Text('You are not currently signed in.'),
           ElevatedButton(
             child: const Text('SIGN IN'),
             onPressed: _handleSignIn,
diff --git a/packages/google_sign_in/google_sign_in/example/pubspec.yaml b/packages/google_sign_in/google_sign_in/example/pubspec.yaml
index dfd942d..af9ed87 100644
--- a/packages/google_sign_in/google_sign_in/example/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in/example/pubspec.yaml
@@ -20,11 +20,10 @@
 
 dev_dependencies:
   espresso: ^0.1.0+2
-  pedantic: ^1.10.0
-  integration_test:
-    sdk: flutter
   flutter_driver:
     sdk: flutter
+  integration_test:
+    sdk: flutter
 
 flutter:
   uses-material-design: true
diff --git a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart
index e104093..6afd409 100644
--- a/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart
+++ b/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart
@@ -5,6 +5,7 @@
 import 'dart:async';
 import 'dart:ui' show hashValues;
 
+import 'package:flutter/foundation.dart';
 import 'package:flutter/services.dart' show PlatformException;
 import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
 
@@ -39,6 +40,7 @@
 /// [GoogleSignInUserData].
 ///
 /// [id] is guaranteed to be non-null.
+@immutable
 class GoogleSignInAccount implements GoogleIdentity {
   GoogleSignInAccount._(this._googleSignIn, GoogleSignInUserData data)
       : displayName = data.displayName,
@@ -99,9 +101,7 @@
 
     // On Android, there isn't an API for refreshing the idToken, so re-use
     // the one we obtained on login.
-    if (response.idToken == null) {
-      response.idToken = _idToken;
-    }
+    response.idToken ??= _idToken;
 
     return GoogleSignInAuthentication._(response);
   }
@@ -113,10 +113,10 @@
   Future<Map<String, String>> get authHeaders async {
     final String? token = (await authentication).accessToken;
     return <String, String>{
-      "Authorization": "Bearer $token",
+      'Authorization': 'Bearer $token',
       // TODO(kevmoo): Use the correct value once it's available from authentication
       // See https://github.com/flutter/flutter/issues/80905
-      "X-Goog-AuthUser": "0",
+      'X-Goog-AuthUser': '0',
     };
   }
 
@@ -131,8 +131,12 @@
 
   @override
   bool operator ==(dynamic other) {
-    if (identical(this, other)) return true;
-    if (other is! GoogleSignInAccount) return false;
+    if (identical(this, other)) {
+      return true;
+    }
+    if (other is! GoogleSignInAccount) {
+      return false;
+    }
     final GoogleSignInAccount otherAccount = other;
     return displayName == otherAccount.displayName &&
         email == otherAccount.email &&
@@ -228,7 +232,7 @@
   /// Client ID being used to connect to google sign-in. Only supported on web.
   final String? clientId;
 
-  StreamController<GoogleSignInAccount?> _currentUserController =
+  final StreamController<GoogleSignInAccount?> _currentUserController =
       StreamController<GoogleSignInAccount?>.broadcast();
 
   /// Subscribe to this stream to be notified when the current user changes.
@@ -277,7 +281,7 @@
     final Completer<void> completer = Completer<void>();
     future.whenComplete(completer.complete).catchError((dynamic _) {
       // Ignore if previous call completed with an error.
-      // TODO: Should we log errors here, if debug or similar?
+      // TODO(ditman): Should we log errors here, if debug or similar?
     });
     return completer.future;
   }
diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart
index c031cb2..61f8913 100644
--- a/packages/google_sign_in/google_sign_in/lib/widgets.dart
+++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart
@@ -118,7 +118,7 @@
 ///
 /// Those bytes come from `resources/transparentImage.gif`.
 final Uint8List _transparentImage = Uint8List.fromList(
-  [
+  <int>[
     0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, //
     0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x21, 0xf9, 0x04, 0x01, 0x00, //
     0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, //
diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml
index 40f8d0f..de15d0b 100644
--- a/packages/google_sign_in/google_sign_in/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in/pubspec.yaml
@@ -3,7 +3,7 @@
   for signing in with a Google account on Android and iOS.
 repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in/google_sign_in
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
-version: 5.2.3
+version: 5.2.4
 
 environment:
   sdk: ">=2.14.0 <3.0.0"
@@ -34,7 +34,6 @@
   http: ^0.13.0
   integration_test:
     sdk: flutter
-  pedantic: ^1.10.0
 
 # The example deliberately includes limited-use secrets.
 false_secrets:
diff --git a/packages/google_sign_in/google_sign_in/test/fife_test.dart b/packages/google_sign_in/google_sign_in/test/fife_test.dart
index c81454e..5b05247 100644
--- a/packages/google_sign_in/google_sign_in/test/fife_test.dart
+++ b/packages/google_sign_in/google_sign_in/test/fife_test.dart
@@ -15,17 +15,17 @@
       const String expected = '$base/s20-c/photo.jpg';
 
       test('with directives, sets size', () {
-        final String url = '$base/s64-c/photo.jpg';
+        const String url = '$base/s64-c/photo.jpg';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
 
       test('no directives, sets size and crop', () {
-        final String url = '$base/photo.jpg';
+        const String url = '$base/photo.jpg';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
 
       test('no crop, sets size and crop', () {
-        final String url = '$base/s64/photo.jpg';
+        const String url = '$base/s64/photo.jpg';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
     });
@@ -36,29 +36,29 @@
       const String expected = '$base=c-s20';
 
       test('with directives, sets size', () {
-        final String url = '$base=s120-c';
+        const String url = '$base=s120-c';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
 
       test('no directives, sets size and crop', () {
-        final String url = base;
+        const String url = base;
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
 
       test('no directives, but with an equals sign, sets size and crop', () {
-        final String url = '$base=';
+        const String url = '$base=';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
 
       test('no crop, adds crop', () {
-        final String url = '$base=s120';
+        const String url = '$base=s120';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
 
       test('many directives, sets size and crop, preserves other directives',
           () {
-        final String url = '$base=s120-c-fSoften=1,50,0';
-        final String expected = '$base=c-fSoften=1,50,0-s20';
+        const String url = '$base=s120-c-fSoften=1,50,0';
+        const String expected = '$base=c-fSoften=1,50,0-s20';
         expect(addSizeDirectiveToUrl(url, size), expected);
       });
     });
diff --git a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
index 0a019a2..119ee50 100644
--- a/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
+++ b/packages/google_sign_in/google_sign_in/test/google_sign_in_test.dart
@@ -6,9 +6,9 @@
 
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
-import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
 import 'package:google_sign_in/google_sign_in.dart';
 import 'package:google_sign_in/testing.dart';
+import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
 
 void main() {
   TestWidgetsFlutterBinding.ensureInitialized();
@@ -19,11 +19,11 @@
     );
 
     const Map<String, String> kUserData = <String, String>{
-      "email": "john.doe@gmail.com",
-      "id": "8162538176523816253123",
-      "photoUrl": "https://lh5.googleusercontent.com/photo.jpg",
-      "displayName": "John Doe",
-      "serverAuthCode": "789"
+      'email': 'john.doe@gmail.com',
+      'id': '8162538176523816253123',
+      'photoUrl': 'https://lh5.googleusercontent.com/photo.jpg',
+      'displayName': 'John Doe',
+      'serverAuthCode': '789'
     };
 
     const Map<String, dynamic> kDefaultResponses = <String, dynamic>{
@@ -84,7 +84,7 @@
     });
 
     test('signIn prioritize clientId parameter when available', () async {
-      final fakeClientId = 'fakeClientId';
+      const String fakeClientId = 'fakeClientId';
       googleSignIn = GoogleSignIn(clientId: fakeClientId);
       await googleSignIn.signIn();
       expect(googleSignIn.currentUser, isNotNull);
@@ -269,14 +269,14 @@
 
     test('signInSilently suppresses errors by default', () async {
       channel.setMockMethodCallHandler((MethodCall methodCall) {
-        throw "I am an error";
+        throw 'I am an error';
       });
       expect(await googleSignIn.signInSilently(), isNull); // should not throw
     });
 
     test('signInSilently forwards errors', () async {
       channel.setMockMethodCallHandler((MethodCall methodCall) {
-        throw "I am an error";
+        throw 'I am an error';
       });
       expect(googleSignIn.signInSilently(suppressErrors: false),
           throwsA(isInstanceOf<PlatformException>()));
@@ -304,7 +304,7 @@
         if (methodCall.method == 'init') {
           initCount++;
           if (initCount == 1) {
-            throw "First init fails";
+            throw 'First init fails';
           }
         }
         return Future<dynamic>.value(responses[methodCall.method]);
@@ -364,7 +364,8 @@
 
     test('requestScopes returns true once new scope is granted', () async {
       await googleSignIn.signIn();
-      final result = await googleSignIn.requestScopes(['testScope']);
+      final bool result =
+          await googleSignIn.requestScopes(<String>['testScope']);
 
       expect(result, isTrue);
       expect(
@@ -373,7 +374,7 @@
           _isSignInMethodCall(),
           isMethodCall('signIn', arguments: null),
           isMethodCall('requestScopes', arguments: <String, dynamic>{
-            'scopes': ['testScope'],
+            'scopes': <String>['testScope'],
           }),
         ],
       );
@@ -382,10 +383,10 @@
 
   group('GoogleSignIn with fake backend', () {
     const FakeUser kUserData = FakeUser(
-        id: "8162538176523816253123",
-        displayName: "John Doe",
-        email: "john.doe@gmail.com",
-        photoUrl: "https://lh5.googleusercontent.com/photo.jpg",
+        id: '8162538176523816253123',
+        displayName: 'John Doe',
+        email: 'john.doe@gmail.com',
+        photoUrl: 'https://lh5.googleusercontent.com/photo.jpg',
         serverAuthCode: '789');
 
     late GoogleSignIn googleSignIn;
diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart
index f7bd6f8..b847bc6 100644
--- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart
+++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart
@@ -18,9 +18,12 @@
     this.photoUrl,
   });
 
+  @override
   final String id;
+  @override
   final String email;
 
+  @override
   final String? photoUrl;
 
   @override
@@ -56,7 +59,7 @@
 ///
 /// Those bytes come from `resources/transparentImage.gif`.
 final Uint8List _transparentImage = Uint8List.fromList(
-  [
+  <int>[
     0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, //
     0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x21, 0xf9, 0x04, 0x01, 0x00, //
     0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, //
@@ -97,7 +100,7 @@
       id: 'userId',
       photoUrl: 'photoUrl',
     );
-    tester.binding.window.physicalSizeTestValue = Size(100, 100);
+    tester.binding.window.physicalSizeTestValue = const Size(100, 100);
 
     await HttpOverrides.runZoned(
       () async {
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index 0e8e1cb..d10424e 100644
--- a/script/configs/custom_analysis.yaml
+++ b/script/configs/custom_analysis.yaml
@@ -14,7 +14,6 @@
 - google_maps_flutter/google_maps_flutter
 - google_maps_flutter/google_maps_flutter_platform_interface
 - google_maps_flutter/google_maps_flutter_web
-- google_sign_in/google_sign_in
 - in_app_purchase/in_app_purchase
 - in_app_purchase/in_app_purchase_android
 - in_app_purchase/in_app_purchase_storekit