@@ -20,7 +20,7 @@ To use the firebase_auth plugin, follow the [plugin installation instructions](h
2020Enable the Google services by configuring the Gradle scripts as such.
2121
22221 . Add the classpath to the ` [project]/android/build.gradle ` file.
23- ```
23+ ``` gradle
2424dependencies {
2525 // Example existing classpath
2626 classpath 'com.android.tools.build:gradle:3.1.2'
@@ -30,7 +30,7 @@ dependencies {
3030```
3131
32322 . Add the apply plugin to the ` [project]/android/app/build.gradle ` file.
33- ```
33+ ``` gradle
3434// ADD THIS AT THE BOTTOM
3535apply plugin: 'com.google.gms.google-services'
3636```
@@ -48,17 +48,18 @@ Otherwise you will not be able to authenticate.
4848### Use the plugin
4949
5050Add the following imports to your Dart code:
51- ```
51+ ``` dart
5252import 'package:firebase_auth/firebase_auth.dart';
5353```
5454
55- Initialize ` FirebaseAuth ` :
56- ```
55+ Initialize ` GoogleSignIn ` and ` FirebaseAuth ` :
56+ ``` dart
57+ final GoogleSignIn _googleSignIn = GoogleSignIn();
5758final FirebaseAuth _auth = FirebaseAuth.instance;
5859```
5960
6061You can now use the Firebase ` _auth ` to authenticate in your Dart code, e.g.
61- ```
62+ ``` dart
6263Future<FirebaseUser> _handleSignIn() async {
6364 GoogleSignInAccount googleUser = await _googleSignIn.signIn();
6465 GoogleSignInAuthentication googleAuth = await googleUser.authentication;
@@ -73,7 +74,7 @@ Future<FirebaseUser> _handleSignIn() async {
7374
7475Then from the sign in button onPress, call the ` _handleSignIn ` method using a future
7576callback for both the ` FirebaseUser ` and possible exception.
76- ```
77+ ``` dart
7778_handleSignIn()
7879 .then((FirebaseUser user) => print(user))
7980 .catchError((e) => print(e));
0 commit comments