diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart index 12f1fd66ec..6fe6120671 100755 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart @@ -34,13 +34,13 @@ class SignInDemo extends StatefulWidget { /// The state of the main widget. 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; }); @@ -57,14 +57,14 @@ class SignInDemoState extends State { }); final PeopleServiceApi peopleApi = - PeopleServiceApi(await _googleSignIn.authenticatedClient()); + PeopleServiceApi((await _googleSignIn.authenticatedClient())!); final ListConnectionsResponse response = await peopleApi.people.connections.list( 'people/me', personFields: 'names', ); - final String firstNamedContactName = + final String? firstNamedContactName = _pickFirstNamedContact(response.connections); setState(() { @@ -76,18 +76,16 @@ class SignInDemoState extends State { }); } - String _pickFirstNamedContact(List connections) { + String? _pickFirstNamedContact(List? connections) { return connections ?.firstWhere( (Person person) => person.names != null, - orElse: () => null, ) - ?.names + .names ?.firstWhere( (Name name) => name.displayName != null, - orElse: () => null, ) - ?.displayName; + .displayName; } Future _handleSignIn() async { @@ -107,10 +105,10 @@ class SignInDemoState extends State { children: [ ListTile( leading: GoogleUserCircleAvatar( - identity: _currentUser, + identity: _currentUser!, ), - title: Text(_currentUser.displayName ?? ''), - subtitle: Text(_currentUser.email ?? ''), + title: Text(_currentUser!.displayName ?? ''), + subtitle: Text(_currentUser!.email), ), const Text('Signed in successfully.'), Text(_contactText ?? ''), diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml index bc9070ac04..b5ed9a12c6 100755 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/pubspec.yaml @@ -1,5 +1,6 @@ name: extension_google_sign_in_example description: Example of Google Sign-In plugin and googleapis. +publish_to: none dependencies: extension_google_sign_in_as_googleapis_auth: @@ -12,7 +13,7 @@ dependencies: flutter: sdk: flutter google_sign_in: ^5.0.0 - googleapis: ^1.0.0 + googleapis: ^2.0.0 dev_dependencies: pedantic: ^1.10.0 @@ -21,5 +22,5 @@ flutter: uses-material-design: true environment: - sdk: ">=2.0.0-dev.28.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4" + sdk: ">=2.12.0 <3.0.0" + flutter: ">=1.20.0"