[google_sign_in] Fix pedantic lints (#2364)
diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md
index c31773b..a87a8a2 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 @@
+## 4.0.17
+
+* Add missing documentation and fix an unawaited future in the example app.
+
## 4.0.16
* Remove the deprecated `author:` field from pubspec.yaml
@@ -57,8 +61,8 @@
## 4.0.3
-* Update guava to `27.0.1-android`.
-* Add correct @NonNull annotations to reduce compiler warnings.
+* Update guava to `27.0.1-android`.
+* Add correct @NonNull annotations to reduce compiler warnings.
## 4.0.2
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 e1dadb9..0000000
--- a/packages/google_sign_in/google_sign_in/analysis_options.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-# This is a temporary file to allow us to land a new set of linter rules in a
-# series of manageable patches instead of one gigantic PR. It disables some of
-# the new lints that are already failing on this plugin, for this plugin. It
-# should be deleted and the failing lints addressed as soon as possible.
-
-include: ../../../analysis_options.yaml
-
-analyzer:
- errors:
- public_member_api_docs: ignore
- unawaited_futures: ignore
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 6973a36..6c66d56 100755
--- a/packages/google_sign_in/google_sign_in/example/lib/main.dart
+++ b/packages/google_sign_in/google_sign_in/example/lib/main.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: public_member_api_docs
+
import 'dart:async';
import 'dart:convert' show json;
@@ -102,9 +104,7 @@
}
}
- Future<void> _handleSignOut() async {
- _googleSignIn.disconnect();
- }
+ Future<void> _handleSignOut() => _googleSignIn.disconnect();
Widget _buildBody() {
if (_currentUser != null) {
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 2f30e72..a78e921 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
@@ -15,6 +15,7 @@
export 'src/common.dart';
export 'widgets.dart';
+/// Holds authentication tokens after sign in.
class GoogleSignInAuthentication {
GoogleSignInAuthentication._(this._data);
@@ -30,6 +31,10 @@
String toString() => 'GoogleSignInAuthentication:$_data';
}
+/// Holds fields describing a signed in user's identity, following
+/// [GoogleSignInUserData].
+///
+/// [id] is guaranteed to be non-null.
class GoogleSignInAccount implements GoogleIdentity {
GoogleSignInAccount._(this._googleSignIn, GoogleSignInUserData data)
: displayName = data.displayName,
@@ -92,6 +97,10 @@
return GoogleSignInAuthentication._(response);
}
+ /// Convenience method returning a `<String, String>` map of HTML Authorization
+ /// headers, containing the current `authentication.accessToken`.
+ ///
+ /// See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization.
Future<Map<String, String>> get authHeaders async {
final String token = (await authentication).accessToken;
return <String, String>{
diff --git a/packages/google_sign_in/google_sign_in/lib/testing.dart b/packages/google_sign_in/google_sign_in/lib/testing.dart
index 0bc8d8f..8d62ff4 100644
--- a/packages/google_sign_in/google_sign_in/lib/testing.dart
+++ b/packages/google_sign_in/google_sign_in/lib/testing.dart
@@ -60,8 +60,8 @@
/// Represents a fake user that can be used with the [FakeSignInBackend] to
/// obtain a [GoogleSignInAccount] and simulate authentication.
-///
class FakeUser {
+ /// Any of the given parameters can be null.
const FakeUser({
this.id,
this.email,
@@ -71,11 +71,22 @@
this.accessToken,
});
+ /// Will be converted into [GoogleSignInUserData.id].
final String id;
+
+ /// Will be converted into [GoogleSignInUserData.email].
final String email;
+
+ /// Will be converted into [GoogleSignInUserData.displayName].
final String displayName;
+
+ /// Will be converted into [GoogleSignInUserData.photoUrl].
final String photoUrl;
+
+ /// Will be converted into [GoogleSignInTokenData.idToken].
final String idToken;
+
+ /// Will be converted into [GoogleSignInTokenData.accessToken].
final String accessToken;
Map<String, String> get _asMap => <String, String>{
diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml
index 259221b..0176692 100644
--- a/packages/google_sign_in/google_sign_in/pubspec.yaml
+++ b/packages/google_sign_in/google_sign_in/pubspec.yaml
@@ -2,7 +2,7 @@
description: Flutter plugin for Google Sign-In, a secure authentication system
for signing in with a Google account on Android and iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in
-version: 4.0.16
+version: 4.0.17
flutter:
plugin:
diff --git a/script/incremental_build.sh b/script/incremental_build.sh
index 968e96b..9534d62 100755
--- a/script/incremental_build.sh
+++ b/script/incremental_build.sh
@@ -16,7 +16,6 @@
CUSTOM_ANALYSIS_PLUGINS=(
"in_app_purchase"
"camera"
- "google_sign_in/google_sign_in"
)
# Comma-separated string of the list above
readonly CUSTOM_FLAG=$(IFS=, ; echo "${CUSTOM_ANALYSIS_PLUGINS[*]}")