GoogleSignIn class
GoogleSignIn allows you to authenticate Google users.
Constructors
-
GoogleSignIn({SignInOption signInOption = SignInOption.standard, List<
String> scopes = const <String>[], String? hostedDomain, String? clientId, String? serverClientId, bool forceCodeForRefreshToken = false}) - Initializes global sign-in configuration settings.
- GoogleSignIn.games()
-
Factory for creating sign in suitable for games. This option is only
supported on Android.
factory
-
GoogleSignIn.standard({List<
String> scopes = const <String>[], String? hostedDomain}) -
Factory for creating default sign in user experience.
factory
Properties
- clientId → String?
-
Client ID being used to connect to google sign-in.
final
- currentUser → GoogleSignInAccount?
-
The currently signed in account, or null if the user is signed out.
no setter
- forceCodeForRefreshToken → bool
-
Force the authorization code to be valid for a refresh token every time. Only needed on Android.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hostedDomain → String?
-
Domain to restrict sign-in to.
final
-
onCurrentUserChanged
→ Stream<
GoogleSignInAccount?> -
Subscribe to this stream to be notified when the current user changes.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scopes
→ List<
String> -
The list of scopes are OAuth scope codes requested when signing in.
final
- serverClientId → String?
-
Client ID of the backend server to which the app needs to authenticate
itself.
final
- signInOption → SignInOption
-
Option to determine the sign in user experience. SignInOption.games is
only supported on Android.
final
Methods
-
canAccessScopes(
List< String> scopes, {String? accessToken}) → Future<bool> -
Checks if the current user has granted access to all the specified
scopes
. -
disconnect(
) → Future< GoogleSignInAccount?> - Disconnects the current user from the app and revokes previous authentication.
-
isSignedIn(
) → Future< bool> - Returns a future that resolves to whether a user is currently signed in.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestScopes(
List< String> scopes) → Future<bool> -
Requests the user grants additional Oauth
scopes
. -
signIn(
) → Future< GoogleSignInAccount?> - Starts the interactive sign-in process.
-
signInSilently(
{bool suppressErrors = true, bool reAuthenticate = false}) → Future< GoogleSignInAccount?> - Attempts to sign in a previously authenticated user without interaction.
-
signOut(
) → Future< GoogleSignInAccount?> - Marks current user as being in the signed out state.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kNetworkError → const String
- Error code indicating network error. Retrying should resolve the problem.
- kSignInCanceledError → const String
- Error code indicating that interactive sign in process was canceled by the user.
- kSignInFailedError → const String
- Error code indicating that attempt to sign in failed.
- kSignInRequiredError → const String
- Error code indicating there is no signed in user and interactive sign in flow is required.