Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit cbdd090

Browse files
committed
Make some fields nullable in the JS-interop file.
1 parent c806547 commit cbdd090

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

packages/google_sign_in/google_sign_in_web/lib/google_sign_in_web.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class GoogleSignInPlugin extends GoogleSignInPlatform {
201201

202202
if (currentUser == null) return false;
203203

204-
final grantedScopes = currentUser.getGrantedScopes();
204+
final grantedScopes = currentUser.getGrantedScopes() ?? '';
205205
final missingScopes =
206206
scopes.where((scope) => !grantedScopes.contains(scope));
207207

packages/google_sign_in/google_sign_in_web/lib/src/generated/gapiauth2.dart

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -268,28 +268,28 @@ abstract class BasicProfile {
268268
@anonymous
269269
@JS()
270270
abstract class AuthResponse {
271-
external String get access_token;
272-
external set access_token(String v);
273-
external String get id_token;
274-
external set id_token(String v);
275-
external String get login_hint;
276-
external set login_hint(String v);
277-
external String get scope;
278-
external set scope(String v);
279-
external num get expires_in;
280-
external set expires_in(num v);
281-
external num get first_issued_at;
282-
external set first_issued_at(num v);
283-
external num get expires_at;
284-
external set expires_at(num v);
271+
external String? get access_token;
272+
external set access_token(String? v);
273+
external String? get id_token;
274+
external set id_token(String? v);
275+
external String? get login_hint;
276+
external set login_hint(String? v);
277+
external String? get scope;
278+
external set scope(String? v);
279+
external num? get expires_in;
280+
external set expires_in(num? v);
281+
external num? get first_issued_at;
282+
external set first_issued_at(num? v);
283+
external num? get expires_at;
284+
external set expires_at(num? v);
285285
external factory AuthResponse(
286-
{String access_token,
287-
String id_token,
288-
String login_hint,
289-
String scope,
290-
num expires_in,
291-
num first_issued_at,
292-
num expires_at});
286+
{String? access_token,
287+
String? id_token,
288+
String? login_hint,
289+
String? scope,
290+
num? expires_in,
291+
num? first_issued_at,
292+
num? expires_at});
293293
}
294294

295295
/// Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2authorizeconfig
@@ -368,23 +368,22 @@ abstract class AuthorizeResponse {
368368
@JS()
369369
abstract class GoogleUser {
370370
/// Get the user's unique ID string.
371-
external String getId();
371+
external String? getId();
372372

373373
/// Returns true if the user is signed in.
374374
external bool isSignedIn();
375375

376376
/// Get the user's Google Apps domain if the user signed in with a Google Apps account.
377-
// TODO: Maybe null?
378-
external String getHostedDomain();
377+
external String? getHostedDomain();
379378

380379
/// Get the scopes that the user granted as a space-delimited string.
381-
external String getGrantedScopes();
380+
external String? getGrantedScopes();
382381

383382
/// Get the user's basic profile information.
384383
external BasicProfile? getBasicProfile();
385384

386385
/// Get the response object from the user's auth session.
387-
// TODO: Maybe null?
386+
// This returns an empty JS object when the user hasn't attempted to sign in.
388387
external AuthResponse getAuthResponse([bool includeAuthorizationData]);
389388

390389
/// Returns true if the user granted the specified scopes.

0 commit comments

Comments
 (0)