cloud firestore flutter
dependencies:
cloud_firestore: ^2.4.0
cloud firestore flutter
dependencies:
cloud_firestore: ^2.4.0
flutter firebase google auth
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
class GoogleAuth {
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignIn googleSignIn = GoogleSignIn();
User getUser() {
return _auth.currentUser;
}
Future<String> getUserId() async {
final User user = _auth.currentUser;
final uid = user.uid;
return uid;
}
Future<User> signInWithGoogle() async {
final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;
final AuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken,
);
final UserCredential authResult =
await _auth.signInWithCredential(credential);
final User user = authResult.user;
assert(!user.isAnonymous);
assert(await user.getIdToken() != null);
final User currentUser = _auth.currentUser;
assert(user.uid == currentUser.uid);
print('signInWithGoogle succeeded: $user');
return currentUser;
}
void signOutGoogle() async {
await googleSignIn.signOut();
print("User Sign Out");
}
}
cloud firestore docs for flutter
final databaseReference = Firestore.instance;
cloud firestore docs for flutter
import 'package:cloud_firestore/cloud_firestore.dart';
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us