- I have two attributes in my
eventClick table eventID and userID so what I am trying to do is if eventID and userID normally exists then show You have already clicked if not then make an entry of the click. I thought of using two clause and merging it but that just resulted in insertion of the values.
- I am trying using the below code
final checkSnapshot = FirebaseFirestore.instance
.collection('eventClick')
.where('eventID', isEqualTo: eventID)
.where('userID', isEqualTo: userID)
.snapshots();
- I want the working to be like
if (checkSnapshot.exists) {
print('already exists');
} else {
FirebaseFirestore.instance.collection('eventClick').add({
'eventID': eventID,
'eventName': eventName,
'eventImageUrl': eventImageUrl,
'userID': userID
});
}