@@ -22,13 +22,13 @@ class GoogleSignInAuthentication {
2222 final GoogleSignInTokenData _data;
2323
2424 /// An OpenID Connect ID token that identifies the user.
25- String get idToken => _data.idToken;
25+ String ? get idToken => _data.idToken;
2626
2727 /// The OAuth2 access token to access Google services.
28- String get accessToken => _data.accessToken;
28+ String ? get accessToken => _data.accessToken;
2929
3030 /// Server auth code used to access Google Login
31- String get serverAuthCode => _data.serverAuthCode;
31+ String ? get serverAuthCode => _data.serverAuthCode;
3232
3333 @override
3434 String toString () => 'GoogleSignInAuthentication:$_data ' ;
@@ -57,7 +57,7 @@ class GoogleSignInAccount implements GoogleIdentity {
5757 static const String kUserRecoverableAuthError = 'user_recoverable_auth' ;
5858
5959 @override
60- final String displayName;
60+ final String ? displayName;
6161
6262 @override
6363 final String email;
@@ -66,9 +66,9 @@ class GoogleSignInAccount implements GoogleIdentity {
6666 final String id;
6767
6868 @override
69- final String photoUrl;
69+ final String ? photoUrl;
7070
71- final String _idToken;
71+ final String ? _idToken;
7272 final GoogleSignIn _googleSignIn;
7373
7474 /// Retrieve [GoogleSignInAuthentication] for this account.
@@ -105,7 +105,7 @@ class GoogleSignInAccount implements GoogleIdentity {
105105 ///
106106 /// See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization.
107107 Future <Map <String , String >> get authHeaders async {
108- final String token = (await authentication).accessToken;
108+ final String ? token = (await authentication).accessToken;
109109 return < String , String > {
110110 "Authorization" : "Bearer $token " ,
111111 "X-Goog-AuthUser" : "0" ,
@@ -117,7 +117,7 @@ class GoogleSignInAccount implements GoogleIdentity {
117117 /// If client runs into 401 errors using a token, it is expected to call
118118 /// this method and grab `authHeaders` once again.
119119 Future <void > clearAuthCache () async {
120- final String token = (await authentication).accessToken;
120+ final String token = (await authentication).accessToken! ;
121121 await GoogleSignInPlatform .instance.clearAuthCache (token: token);
122122 }
123123
@@ -174,7 +174,7 @@ class GoogleSignIn {
174174 /// Factory for creating default sign in user experience.
175175 factory GoogleSignIn .standard ({
176176 List <String > scopes = const < String > [],
177- String hostedDomain,
177+ String ? hostedDomain,
178178 }) {
179179 return GoogleSignIn (
180180 signInOption: SignInOption .standard,
@@ -212,22 +212,22 @@ class GoogleSignIn {
212212 final List <String > scopes;
213213
214214 /// Domain to restrict sign-in to.
215- final String hostedDomain;
215+ final String ? hostedDomain;
216216
217217 /// Client ID being used to connect to google sign-in. Only supported on web.
218- final String clientId;
218+ final String ? clientId;
219219
220- StreamController <GoogleSignInAccount > _currentUserController =
221- StreamController <GoogleSignInAccount >.broadcast ();
220+ StreamController <GoogleSignInAccount ? > _currentUserController =
221+ StreamController <GoogleSignInAccount ? >.broadcast ();
222222
223223 /// Subscribe to this stream to be notified when the current user changes.
224- Stream <GoogleSignInAccount > get onCurrentUserChanged =>
224+ Stream <GoogleSignInAccount ? > get onCurrentUserChanged =>
225225 _currentUserController.stream;
226226
227227 // Future that completes when we've finished calling `init` on the native side
228- Future <void > _initialization;
228+ Future <void >? _initialization;
229229
230- Future <GoogleSignInAccount > _callMethod (Function method) async {
230+ Future <GoogleSignInAccount ? > _callMethod (Function method) async {
231231 await _ensureInitialized ();
232232
233233 final dynamic response = await method ();
@@ -237,7 +237,7 @@ class GoogleSignIn {
237237 : null );
238238 }
239239
240- GoogleSignInAccount _setCurrentUser (GoogleSignInAccount currentUser) {
240+ GoogleSignInAccount ? _setCurrentUser (GoogleSignInAccount ? currentUser) {
241241 if (currentUser != _currentUser) {
242242 _currentUser = currentUser;
243243 _currentUserController.add (_currentUser);
@@ -258,7 +258,7 @@ class GoogleSignIn {
258258 }
259259
260260 /// The most recently scheduled method call.
261- Future <void > _lastMethodCall;
261+ Future <void >? _lastMethodCall;
262262
263263 /// Returns a [Future] that completes with a success after [future] , whether
264264 /// it completed with a value or an error.
@@ -279,15 +279,15 @@ class GoogleSignIn {
279279 /// The optional, named parameter [canSkipCall] lets the plugin know that the
280280 /// method call may be skipped, if there's already [_currentUser] information.
281281 /// This is used from the [signIn] and [signInSilently] methods.
282- Future <GoogleSignInAccount > _addMethodCall (
282+ Future <GoogleSignInAccount ? > _addMethodCall (
283283 Function method, {
284284 bool canSkipCall = false ,
285285 }) async {
286- Future <GoogleSignInAccount > response;
286+ Future <GoogleSignInAccount ? > response;
287287 if (_lastMethodCall == null ) {
288288 response = _callMethod (method);
289289 } else {
290- response = _lastMethodCall.then ((_) {
290+ response = _lastMethodCall! .then ((_) {
291291 // If after the last completed call `currentUser` is not `null` and requested
292292 // method can be skipped (`canSkipCall`), re-use the same authenticated user
293293 // instead of making extra call to the native side.
@@ -303,8 +303,8 @@ class GoogleSignIn {
303303 }
304304
305305 /// The currently signed in account, or null if the user is signed out.
306- GoogleSignInAccount get currentUser => _currentUser;
307- GoogleSignInAccount _currentUser;
306+ GoogleSignInAccount ? get currentUser => _currentUser;
307+ GoogleSignInAccount ? _currentUser;
308308
309309 /// Attempts to sign in a previously authenticated user without interaction.
310310 ///
@@ -323,7 +323,7 @@ class GoogleSignIn {
323323 /// one of [kSignInRequiredError] (when there is no authenticated user) ,
324324 /// [kNetworkError] (when a network error occurred) or [kSignInFailedError]
325325 /// (when an unknown error occurred).
326- Future <GoogleSignInAccount > signInSilently ({
326+ Future <GoogleSignInAccount ? > signInSilently ({
327327 bool suppressErrors = true ,
328328 }) async {
329329 try {
@@ -354,21 +354,21 @@ class GoogleSignIn {
354354 /// a Future which resolves to the same user instance.
355355 ///
356356 /// Re-authentication can be triggered only after [signOut] or [disconnect] .
357- Future <GoogleSignInAccount > signIn () {
358- final Future <GoogleSignInAccount > result =
357+ Future <GoogleSignInAccount ? > signIn () {
358+ final Future <GoogleSignInAccount ? > result =
359359 _addMethodCall (GoogleSignInPlatform .instance.signIn, canSkipCall: true );
360360 bool isCanceled (dynamic error) =>
361361 error is PlatformException && error.code == kSignInCanceledError;
362362 return result.catchError ((dynamic _) => null , test: isCanceled);
363363 }
364364
365365 /// Marks current user as being in the signed out state.
366- Future <GoogleSignInAccount > signOut () =>
366+ Future <GoogleSignInAccount ? > signOut () =>
367367 _addMethodCall (GoogleSignInPlatform .instance.signOut);
368368
369369 /// Disconnects the current user from the app and revokes previous
370370 /// authentication.
371- Future <GoogleSignInAccount > disconnect () =>
371+ Future <GoogleSignInAccount ? > disconnect () =>
372372 _addMethodCall (GoogleSignInPlatform .instance.disconnect);
373373
374374 /// Requests the user grants additional Oauth [scopes] .
0 commit comments