canAccessScopes method

Future<bool> canAccessScopes(
  1. List<String> scopes, {
  2. String? accessToken,
})

Checks if the current user has granted access to all the specified scopes.

Optionally, an accessToken can be passed to perform this check. This may be useful when an application holds on to a cached, potentially long-lived accessToken.

Implementation

Future<bool> canAccessScopes(
  List<String> scopes, {
  String? accessToken,
}) async {
  await _ensureInitialized();

  final String? token =
      accessToken ?? (await _currentUser?.authentication)?.accessToken;

  return GoogleSignInPlatform.instance.canAccessScopes(
    scopes,
    accessToken: token,
  );
}