I've been trying to implement google_sign_in library for almost two days now. I have done all necessary configurations from both localhost and the firebase console.
Dependencies:
firebase_analytics: ^5.0.2
firebase_auth: ^0.14.0+5
cloud_firestore: ^0.13.5
flutter_facebook_login: ^3.0.0
mvc_pattern: ^5.0.0
flutter_screenutil: ^0.5.3
google_sign_in: ^4.4.4
Below is the _googleSignUp()
custom function.
Future<void> _googleSignUp() async {
try {
final GoogleSignIn _googleSignIn = GoogleSignIn(
scopes: [
'email',
'https://www.googleapis.com/auth/contacts.readonly',
],
hostedDomain: '',
clientId: '',
);
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
idToken: googleAuth.accessToken, accessToken: googleAuth.idToken);
final FirebaseUser user =
(await _auth.signInWithCredential(credential)).user;
print('Current user: ${user.displayName}');
return user;
} catch (e) {
print(e.message);
}
}
The problem is, whenever I trigger the _googleSignUp()
funtion with a button
click, I keep getting this log below and then nothing happens.
I/flutter (31065): No implementation found for method init on channel plugins.flutter.io/google_sign_in
Developers how do we fix this? Thank you.