[google_sign_in] Update platform interface analysis options (#4872)
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md b/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md
index 9281860..66fdb3e 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md
+++ b/packages/google_sign_in/google_sign_in_platform_interface/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.1.2
+
+* Internal code cleanup for stricter analysis options.
+
## 2.1.1
* Removes dependency on `meta`.
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/analysis_options.yaml b/packages/google_sign_in/google_sign_in_platform_interface/analysis_options.yaml
deleted file mode 100644
index 5aeb4e7..0000000
--- a/packages/google_sign_in/google_sign_in_platform_interface/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../../analysis_options_legacy.yaml
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart
index c569133..1abda09 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart
+++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/method_channel_google_sign_in.dart
@@ -55,7 +55,7 @@
.invokeMapMethod<String, dynamic>('getTokens', <String, dynamic>{
'email': email,
'shouldRecoverAuth': shouldRecoverAuth,
- }).then((result) => getTokenDataFromMap(result!));
+ }).then((Map<String, dynamic>? result) => getTokenDataFromMap(result!));
}
@override
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart
index e30966f..bc50a1d 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart
+++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/types.dart
@@ -71,13 +71,21 @@
String? serverAuthCode;
@override
+ // TODO(stuartmorgan): Make this class immutable in the next breaking change.
+ // ignore: avoid_equals_and_hash_code_on_mutable_classes
int get hashCode => hashObjects(
<String?>[displayName, email, id, photoUrl, idToken, serverAuthCode]);
@override
+ // TODO(stuartmorgan): Make this class immutable in the next breaking change.
+ // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(dynamic other) {
- if (identical(this, other)) return true;
- if (other is! GoogleSignInUserData) return false;
+ if (identical(this, other)) {
+ return true;
+ }
+ if (other is! GoogleSignInUserData) {
+ return false;
+ }
final GoogleSignInUserData otherUserData = other;
return otherUserData.displayName == displayName &&
otherUserData.email == email &&
@@ -107,12 +115,20 @@
String? serverAuthCode;
@override
+ // TODO(stuartmorgan): Make this class immutable in the next breaking change.
+ // ignore: avoid_equals_and_hash_code_on_mutable_classes
int get hashCode => hash3(idToken, accessToken, serverAuthCode);
@override
+ // TODO(stuartmorgan): Make this class immutable in the next breaking change.
+ // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(dynamic other) {
- if (identical(this, other)) return true;
- if (other is! GoogleSignInTokenData) return false;
+ if (identical(this, other)) {
+ return true;
+ }
+ if (other is! GoogleSignInTokenData) {
+ return false;
+ }
final GoogleSignInTokenData otherTokenData = other;
return otherTokenData.idToken == idToken &&
otherTokenData.accessToken == accessToken &&
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/utils.dart b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/utils.dart
index 0d89835..6f03a6c 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/lib/src/utils.dart
+++ b/packages/google_sign_in/google_sign_in_platform_interface/lib/src/utils.dart
@@ -10,19 +10,19 @@
return null;
}
return GoogleSignInUserData(
- email: data['email']!,
- id: data['id']!,
- displayName: data['displayName'],
- photoUrl: data['photoUrl'],
- idToken: data['idToken'],
- serverAuthCode: data['serverAuthCode']);
+ email: data['email']! as String,
+ id: data['id']! as String,
+ displayName: data['displayName'] as String?,
+ photoUrl: data['photoUrl'] as String?,
+ idToken: data['idToken'] as String?,
+ serverAuthCode: data['serverAuthCode'] as String?);
}
/// Converts token data coming from native code into the proper platform interface type.
GoogleSignInTokenData getTokenDataFromMap(Map<String, dynamic> data) {
return GoogleSignInTokenData(
- idToken: data['idToken'],
- accessToken: data['accessToken'],
- serverAuthCode: data['serverAuthCode'],
+ idToken: data['idToken'] as String?,
+ accessToken: data['accessToken'] as String?,
+ serverAuthCode: data['serverAuthCode'] as String?,
);
}
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml b/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml
index f5a7eb8..a5bbaed 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in_platform_interface/pubspec.yaml
@@ -4,7 +4,7 @@
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
-version: 2.1.1
+version: 2.1.2
environment:
sdk: ">=2.12.0 <3.0.0"
@@ -19,4 +19,3 @@
flutter_test:
sdk: flutter
mockito: ^5.0.0
- pedantic: ^1.10.0
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart b/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart
index a3450b6..78e57a3 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart
+++ b/packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
import 'package:mockito/mockito.dart';
void main() {
diff --git a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart
index fcb443f..a1d83c3 100644
--- a/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart
+++ b/packages/google_sign_in/google_sign_in_platform_interface/test/method_channel_google_sign_in_test.dart
@@ -9,10 +9,10 @@
import 'package:google_sign_in_platform_interface/src/utils.dart';
const Map<String, String> kUserData = <String, String>{
- "email": "john.doe@gmail.com",
- "id": "8162538176523816253123",
- "photoUrl": "https://lh5.googleusercontent.com/photo.jpg",
- "displayName": "John Doe",
+ 'email': 'john.doe@gmail.com',
+ 'id': '8162538176523816253123',
+ 'photoUrl': 'https://lh5.googleusercontent.com/photo.jpg',
+ 'displayName': 'John Doe',
'idToken': '123',
'serverAuthCode': '789',
};
@@ -35,7 +35,7 @@
};
final GoogleSignInUserData? kUser = getUserDataFromMap(kUserData);
-final GoogleSignInTokenData? kToken =
+final GoogleSignInTokenData kToken =
getTokenDataFromMap(kTokenData as Map<String, dynamic>);
void main() {
@@ -122,16 +122,18 @@
'token': 'abc',
}),
() {
- googleSignIn.requestScopes(['newScope', 'anotherScope']);
+ googleSignIn.requestScopes(<String>['newScope', 'anotherScope']);
}: isMethodCall('requestScopes', arguments: <String, dynamic>{
- 'scopes': ['newScope', 'anotherScope'],
+ 'scopes': <String>['newScope', 'anotherScope'],
}),
googleSignIn.signOut: isMethodCall('signOut', arguments: null),
googleSignIn.disconnect: isMethodCall('disconnect', arguments: null),
googleSignIn.isSignedIn: isMethodCall('isSignedIn', arguments: null),
};
- tests.keys.forEach((Function f) => f());
+ for (final Function f in tests.keys) {
+ f();
+ }
expect(log, tests.values);
});
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index b802db1..0022bee 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_platform_interface
- google_sign_in/google_sign_in_web
- in_app_purchase/in_app_purchase
- in_app_purchase/in_app_purchase_android