import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
GoogleSignIn _googleSignIn = new GoogleSignIn(
scopes: <String>[
'profile',
'email',
'https://www.googleapis.com/auth/contacts.readonly',
],
);
Future<void> _handleSignIn() async {
try {
await _googleSignIn.signIn();
print("signed in" + _googleSignIn.currentUser.email);
} catch (error) {
print(error);
}
}
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: RaisedButton(onPressed: () {
_handleSignIn();
}),
),
);
}
}
--------------------library--------------------
google_sign_in: ^4.0.1+1
firebase_auth: ^0.6.6
import 'package:google_sign_in/google_sign_in.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
GoogleSignIn _googleSignIn = new GoogleSignIn(
scopes: <String>[
'profile',
'email',
'https://www.googleapis.com/auth/contacts.readonly',
],
);
Future<void> _handleSignIn() async {
try {
await _googleSignIn.signIn();
print("signed in" + _googleSignIn.currentUser.email);
} catch (error) {
print(error);
}
}
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: RaisedButton(onPressed: () {
_handleSignIn();
}),
),
);
}
}
--------------------library--------------------
google_sign_in: ^4.0.1+1
firebase_auth: ^0.6.6
No comments:
Post a Comment