Posts
Integrating Google Sign-In
- Get link
- X
- Other Apps
By
FlutterTute
-
Firstly add google_sign_in dependencies in your pubspac.yaml file Then add internet permission in your androidManifest.xml file Then write your code in main.dart import 'package:flutter/material.dart' ; import 'package:google_sign_in/google_sign_in.dart' ; GoogleSignIn _googleSignIn = GoogleSignIn(scopes: [ 'profile' , 'email' ]); void main() => runApp(MaterialApp( debugShowCheckedModeBanner: false , title: 'Google Sign in' , home: SignInDemo(), )); class SignInDemo extends StatefulWidget { @override _SignInDemoState createState() => _SignInDemoState(); } class _SignInDemoState extends State<SignInDemo> { GoogleSignInAccount _currentUser; @override void initState() { super .initState(); _googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account){ setState(() { _currentUser = account; }); }); _googleSignIn.signInSilently(); }
Firebase Authentication - Google Login
- Get link
- X
- Other Apps
By
FlutterTute
-