easy_google_sign_in 0.1.0
easy_google_sign_in: ^0.1.0 copied to clipboard
One-liner Google Sign-In for Firebase Auth. Call a single function in onPressed or use the provided button widget.
easy_google_sign_in #
One-liner Google Sign-In for Firebase Auth — just call a function in your button’s onPressed
, or use the included EasyGoogleSignInButton
.
Why? #
You shouldn’t write boilerplate every time. This package wraps:
firebase_auth
for Firebase logingoogle_sign_in
for mobile tokens- Web popup flow for Flutter web
Quick Start #
- Add dependencies to your app (the consumer of this package):
dependencies:
firebase_core: ^3.0.0
firebase_auth: ^5.0.0
easy_google_sign_in: ^0.1.0
- Do the usual Firebase setup (manual, once per app):
- Add
google-services.json
(Android) /GoogleService-Info.plist
(iOS) - Add SHA-1/SHA-256 for Android in Firebase console (keytool)
- For Web, add Firebase config (or use FlutterFire CLI)
- Call
Firebase.initializeApp()
inmain()
- Use it:
ElevatedButton(
onPressed: easyGoogleSignInOnPressed(
onSuccess: (cred) => print('Welcome ${cred.user?.displayName}!'),
),
child: const Text('Sign in with Google'),
);
or
EasyGoogleSignInButton(
onSuccess: (cred) => print('Welcome ${cred.user?.email}!'),
)
Sign out #
await signOutFromGoogle();
Options #
EasyGoogleSignInOptions(
scopes: ['email', 'profile'],
iosClientId: null,
hostedDomain: null,
requestServerAuthCode: false,
showDefaultLoadingOverlay: true,
)
Notes #
- This package does not auto-initialize Firebase for you; apps differ.
- On iOS/macOS, if you use a custom client ID, pass it via
iosClientId
. - On Web we use
signInWithPopup
.
Notes for google_sign_in v7.x #
This package uses the new v7 API (singleton + initialize()
+ authenticate()
).
Only an ID token is provided by the plugin; accessToken
is no longer exposed. For Firebase Auth this is sufficient.