Skip to content

Commit 7668398

Browse files
[google_sign_in] Bump app-facing version for NNBD stable (flutter#3637)
1 parent a0d99ee commit 7668398

File tree

4 files changed

+34
-37
lines changed

4 files changed

+34
-37
lines changed

packages/google_sign_in/google_sign_in/CHANGELOG.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
## 5.0.0-nullsafety.1
1+
## 5.0.0
22

3-
* Document that the web plugin is not endorsed in the `nullsafety` prerelease for now.
4-
5-
## 5.0.0-nullsafety
6-
7-
* Migrate to nnbd.
8-
* **Breaking change**: web plugins aren't endorsed in null-safe plugins yet.
3+
* Migrate to null safety.
94

105
## 4.5.9
116

packages/google_sign_in/google_sign_in/example/lib/main.dart

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,31 @@ class SignInDemo extends StatefulWidget {
3333
}
3434

3535
class SignInDemoState extends State<SignInDemo> {
36-
GoogleSignInAccount _currentUser;
37-
String _contactText;
36+
GoogleSignInAccount? _currentUser;
37+
String _contactText = '';
3838

3939
@override
4040
void initState() {
4141
super.initState();
42-
_googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) {
42+
_googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount? account) {
4343
setState(() {
4444
_currentUser = account;
4545
});
4646
if (_currentUser != null) {
47-
_handleGetContact();
47+
_handleGetContact(_currentUser!);
4848
}
4949
});
5050
_googleSignIn.signInSilently();
5151
}
5252

53-
Future<void> _handleGetContact() async {
53+
Future<void> _handleGetContact(GoogleSignInAccount user) async {
5454
setState(() {
5555
_contactText = "Loading contact info...";
5656
});
5757
final http.Response response = await http.get(
58-
'https://people.googleapis.com/v1/people/me/connections'
59-
'?requestMask.includeField=person.names',
60-
headers: await _currentUser.authHeaders,
58+
Uri.parse('https://people.googleapis.com/v1/people/me/connections'
59+
'?requestMask.includeField=person.names'),
60+
headers: await user.authHeaders,
6161
);
6262
if (response.statusCode != 200) {
6363
setState(() {
@@ -68,7 +68,7 @@ class SignInDemoState extends State<SignInDemo> {
6868
return;
6969
}
7070
final Map<String, dynamic> data = json.decode(response.body);
71-
final String namedContact = _pickFirstNamedContact(data);
71+
final String? namedContact = _pickFirstNamedContact(data);
7272
setState(() {
7373
if (namedContact != null) {
7474
_contactText = "I see you know $namedContact!";
@@ -78,14 +78,14 @@ class SignInDemoState extends State<SignInDemo> {
7878
});
7979
}
8080

81-
String _pickFirstNamedContact(Map<String, dynamic> data) {
82-
final List<dynamic> connections = data['connections'];
83-
final Map<String, dynamic> contact = connections?.firstWhere(
81+
String? _pickFirstNamedContact(Map<String, dynamic> data) {
82+
final List<dynamic>? connections = data['connections'];
83+
final Map<String, dynamic>? contact = connections?.firstWhere(
8484
(dynamic contact) => contact['names'] != null,
8585
orElse: () => null,
8686
);
8787
if (contact != null) {
88-
final Map<String, dynamic> name = contact['names'].firstWhere(
88+
final Map<String, dynamic>? name = contact['names'].firstWhere(
8989
(dynamic name) => name['displayName'] != null,
9090
orElse: () => null,
9191
);
@@ -107,26 +107,27 @@ class SignInDemoState extends State<SignInDemo> {
107107
Future<void> _handleSignOut() => _googleSignIn.disconnect();
108108

109109
Widget _buildBody() {
110-
if (_currentUser != null) {
110+
GoogleSignInAccount? user = _currentUser;
111+
if (user != null) {
111112
return Column(
112113
mainAxisAlignment: MainAxisAlignment.spaceAround,
113114
children: <Widget>[
114115
ListTile(
115116
leading: GoogleUserCircleAvatar(
116-
identity: _currentUser,
117+
identity: user,
117118
),
118-
title: Text(_currentUser.displayName ?? ''),
119-
subtitle: Text(_currentUser.email ?? ''),
119+
title: Text(user.displayName ?? ''),
120+
subtitle: Text(user.email),
120121
),
121122
const Text("Signed in successfully."),
122-
Text(_contactText ?? ''),
123+
Text(_contactText),
123124
ElevatedButton(
124125
child: const Text('SIGN OUT'),
125126
onPressed: _handleSignOut,
126127
),
127128
ElevatedButton(
128129
child: const Text('REFRESH'),
129-
onPressed: _handleGetContact,
130+
onPressed: () => _handleGetContact(user),
130131
),
131132
],
132133
);

packages/google_sign_in/google_sign_in/example/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ dependencies:
1111
# The example app is bundled with the plugin so we use a path dependency on
1212
# the parent directory to use the current plugin's version.
1313
path: ../
14-
http: ^0.12.0
14+
http: ^0.13.0
1515

1616
dev_dependencies:
17-
pedantic: ^1.8.0
17+
pedantic: ^1.10.0
1818
integration_test:
1919
path: ../../../integration_test
2020
flutter_driver:
@@ -24,5 +24,5 @@ flutter:
2424
uses-material-design: true
2525

2626
environment:
27-
sdk: ">=2.0.0-dev.28.0 <3.0.0"
27+
sdk: ">=2.12.0-259.9.beta <3.0.0"
2828
flutter: ">=1.12.13+hotfix.4"

packages/google_sign_in/google_sign_in/pubspec.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_sign_in
22
description: Flutter plugin for Google Sign-In, a secure authentication system
33
for signing in with a Google account on Android and iOS.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in
5-
version: 5.0.0-nullsafety.1
5+
version: 5.0.0
66

77
flutter:
88
plugin:
@@ -12,25 +12,26 @@ flutter:
1212
pluginClass: GoogleSignInPlugin
1313
ios:
1414
pluginClass: FLTGoogleSignInPlugin
15-
#web:
16-
# default_package: google_sign_in_web
15+
web:
16+
default_package: google_sign_in_web
1717

1818
dependencies:
19-
google_sign_in_platform_interface: ^2.0.0-nullsafety
19+
google_sign_in_platform_interface: ^2.0.0
20+
google_sign_in_web: ^0.10.0
2021
flutter:
2122
sdk: flutter
22-
meta: ^1.3.0-nullsafety.6
23+
meta: ^1.3.0
2324

2425
dev_dependencies:
25-
http: ^0.12.0
26+
http: ^0.13.0
2627
flutter_driver:
2728
sdk: flutter
2829
flutter_test:
2930
sdk: flutter
30-
pedantic: ^1.10.0-nullsafety.1
31+
pedantic: ^1.10.0
3132
integration_test:
3233
path: ../../integration_test
3334

3435
environment:
35-
sdk: ">=2.12.0-0 <3.0.0"
36+
sdk: ">=2.12.0-259.9.beta <3.0.0"
3637
flutter: ">=1.12.13+hotfix.5"

0 commit comments

Comments
 (0)