You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: The name 'User' is defined in the libraries 'package:firebase_auth/firebase_auth.dart' and 'package:tuned_in/models/user.dart'. (ambiguous_import at [tuned_in] lib/resources/firebase_methods.dart:13)
#9
final List<DocumentSnapshot> docs = result.documents;
//if user is registered then length of list > 0 or else less than 0
return docs.length == 0 ? true : false;
//this is firebase_methods.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:tuned_in/models/user.dart';
import 'package:tuned_in/utils/utilities.dart';
class FirebaseMethods {
final FirebaseAuth _auth = FirebaseAuth.instance;
GoogleSignIn _googleSignIn = GoogleSignIn();
static final Firestore firestore = Firestore.instance;
//user class
User user = User();
Future getCurrentUser() async {
FirebaseUser currentUser;
currentUser = await _auth.currentUser();
return currentUser;
}
Future signIn() async {
GoogleSignInAccount _signInAccount = await _googleSignIn.signIn();
GoogleSignInAuthentication _signInAuthentication =
await _signInAccount.authentication;
}
Future authenticateUser(FirebaseUser user) async {
QuerySnapshot result = await firestore
.collection("users")
.where("email", isEqualTo: user.email)
.getDocuments();
}
Future addDataToDb(FirebaseUser currentUser) async {
String username = Utils.getUsername(currentUser.email);
}
Future signOut() async {
await _googleSignIn.disconnect();
await _googleSignIn.signOut();
return await _auth.signOut();
}
}
![Screenshot 2020-11-27 at 9 57 07 PM](https://user-images.githubusercontent.com/74764795/100469095-aa7a5300-30fb-11eb-81f5-d11b98bf816d.png)
![Screenshot 2020-11-27 at 9 57 33 PM](https://user-images.githubusercontent.com/74764795/100469123-b6661500-30fb-11eb-8892-0ac5d756ac71.png)
![Screenshot 2020-11-27 at 9 57 40 PM](https://user-images.githubusercontent.com/74764795/100469145-bf56e680-30fb-11eb-86a6-2d7c39486cdb.png)
![Screenshot 2020-11-27 at 9 57 52 PM](https://user-images.githubusercontent.com/74764795/100469162-c3830400-30fb-11eb-9bee-25fea9b5ae4e.png)
//this is my user.dart
class User {
String uid;
String name;
String email;
String username;
String status;
int state;
String profilePhoto;
User({
this.uid,
this.name,
this.email,
this.username,
this.status,
this.state,
this.profilePhoto,
});
Map toMap(User user) {
var data = Map<String, dynamic>();
data['uid'] = user.uid;
data['name'] = user.name;
data['email'] = user.email;
data['username'] = user.username;
data["status"] = user.status;
data["state"] = user.state;
data["profile_photo"] = user.profilePhoto;
return data;
}
User.fromMap(Map<String, dynamic> mapData) {
this.uid = mapData['uid'];
this.name = mapData['name'];
this.email = mapData['email'];
this.username = mapData['username'];
this.status = mapData['status'];
this.state = mapData['state'];
this.profilePhoto = mapData['profile_photo'];
}
}
The text was updated successfully, but these errors were encountered: