From da3cd03200f9e8787554160f6332a3ca84b6e177 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 25 Feb 2021 11:17:39 -0500 Subject: [PATCH 1/4] Update dependencies and version --- packages/google_sign_in/google_sign_in/CHANGELOG.md | 9 ++------- packages/google_sign_in/google_sign_in/pubspec.yaml | 12 ++++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 85c8cc491105..57d1c9be3743 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,11 +1,6 @@ -## 5.0.0-nullsafety.1 +## 5.0.0 -* Document that the web plugin is not endorsed in the `nullsafety` prerelease for now. - -## 5.0.0-nullsafety - -* Migrate to nnbd. -* **Breaking change**: web plugins aren't endorsed in null-safe plugins yet. +* Migrate to null safety. ## 4.5.9 diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index ca1fe8d829b8..98925024d472 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 @@ name: google_sign_in 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: 5.0.0-nullsafety.1 +version: 5.0.0 flutter: plugin: @@ -16,21 +16,21 @@ flutter: # default_package: google_sign_in_web dependencies: - google_sign_in_platform_interface: ^2.0.0-nullsafety + google_sign_in_platform_interface: ^2.0.0 flutter: sdk: flutter - meta: ^1.3.0-nullsafety.6 + meta: ^1.3.0 dev_dependencies: - http: ^0.12.0 + http: ^0.13.0 flutter_driver: sdk: flutter flutter_test: sdk: flutter - pedantic: ^1.10.0-nullsafety.1 + pedantic: ^1.10.0 integration_test: path: ../../integration_test environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.5" From 2714bab6eb8c5a85fdf82cd9363c8346deeda6e5 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 25 Feb 2021 11:28:16 -0500 Subject: [PATCH 2/4] Migrate example --- .../google_sign_in/example/lib/main.dart | 37 ++++++++++--------- .../google_sign_in/example/pubspec.yaml | 6 +-- 2 files changed, 22 insertions(+), 21 deletions(-) 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 a738c248a4a4..b78a83f24fdb 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 @@ -33,31 +33,31 @@ class SignInDemo extends StatefulWidget { } class SignInDemoState extends State { - GoogleSignInAccount _currentUser; - String _contactText; + GoogleSignInAccount? _currentUser; + String? _contactText; @override void initState() { super.initState(); - _googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) { + _googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount? account) { setState(() { _currentUser = account; }); if (_currentUser != null) { - _handleGetContact(); + _handleGetContact(_currentUser!); } }); _googleSignIn.signInSilently(); } - Future _handleGetContact() async { + Future _handleGetContact(GoogleSignInAccount user) async { setState(() { _contactText = "Loading contact info..."; }); final http.Response response = await http.get( - 'https://people.googleapis.com/v1/people/me/connections' - '?requestMask.includeField=person.names', - headers: await _currentUser.authHeaders, + Uri.parse('https://people.googleapis.com/v1/people/me/connections' + '?requestMask.includeField=person.names'), + headers: await user.authHeaders, ); if (response.statusCode != 200) { setState(() { @@ -68,7 +68,7 @@ class SignInDemoState extends State { return; } final Map data = json.decode(response.body); - final String namedContact = _pickFirstNamedContact(data); + final String? namedContact = _pickFirstNamedContact(data); setState(() { if (namedContact != null) { _contactText = "I see you know $namedContact!"; @@ -78,14 +78,14 @@ class SignInDemoState extends State { }); } - String _pickFirstNamedContact(Map data) { - final List connections = data['connections']; - final Map contact = connections?.firstWhere( + String? _pickFirstNamedContact(Map data) { + final List? connections = data['connections']; + final Map? contact = connections?.firstWhere( (dynamic contact) => contact['names'] != null, orElse: () => null, ); if (contact != null) { - final Map name = contact['names'].firstWhere( + final Map? name = contact['names'].firstWhere( (dynamic name) => name['displayName'] != null, orElse: () => null, ); @@ -107,16 +107,17 @@ class SignInDemoState extends State { Future _handleSignOut() => _googleSignIn.disconnect(); Widget _buildBody() { - if (_currentUser != null) { + GoogleSignInAccount? user = _currentUser; + if (user != null) { return Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ListTile( leading: GoogleUserCircleAvatar( - identity: _currentUser, + identity: user, ), - title: Text(_currentUser.displayName ?? ''), - subtitle: Text(_currentUser.email ?? ''), + title: Text(user.displayName ?? ''), + subtitle: Text(user.email), ), const Text("Signed in successfully."), Text(_contactText ?? ''), @@ -126,7 +127,7 @@ class SignInDemoState extends State { ), ElevatedButton( child: const Text('REFRESH'), - onPressed: _handleGetContact, + onPressed: () => _handleGetContact(user), ), ], ); 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 e35aa9ace6a3..b5a1f3e1c2cc 100755 --- a/packages/google_sign_in/google_sign_in/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/example/pubspec.yaml @@ -11,10 +11,10 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - http: ^0.12.0 + http: ^0.13.0 dev_dependencies: - pedantic: ^1.8.0 + pedantic: ^1.10.0 integration_test: path: ../../../integration_test flutter_driver: @@ -24,5 +24,5 @@ flutter: uses-material-design: true environment: - sdk: ">=2.0.0-dev.28.0 <3.0.0" + sdk: ">=2.12.0-259.9.beta <3.0.0" flutter: ">=1.12.13+hotfix.4" From c9b7598329ec9b141d8c8ffb92d82c550576ac92 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 25 Feb 2021 11:41:17 -0500 Subject: [PATCH 3/4] Re-endorse web --- packages/google_sign_in/google_sign_in/pubspec.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index 98925024d472..06fa12c0f4c0 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -12,11 +12,12 @@ flutter: pluginClass: GoogleSignInPlugin ios: pluginClass: FLTGoogleSignInPlugin - #web: - # default_package: google_sign_in_web + web: + default_package: google_sign_in_web dependencies: google_sign_in_platform_interface: ^2.0.0 + google_sign_in_web: ^0.10.0 flutter: sdk: flutter meta: ^1.3.0 From e86bd091e4789d09af53425111cc854a2fba7e52 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 26 Feb 2021 06:07:39 -0500 Subject: [PATCH 4/4] Address review --- packages/google_sign_in/google_sign_in/example/lib/main.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b78a83f24fdb..e003225af5cc 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 @@ -34,7 +34,7 @@ class SignInDemo extends StatefulWidget { class SignInDemoState extends State { GoogleSignInAccount? _currentUser; - String? _contactText; + String _contactText = ''; @override void initState() { @@ -120,7 +120,7 @@ class SignInDemoState extends State { subtitle: Text(user.email), ), const Text("Signed in successfully."), - Text(_contactText ?? ''), + Text(_contactText), ElevatedButton( child: const Text('SIGN OUT'), onPressed: _handleSignOut,