I want to add data into the firestore database if the document ID doesn\'t already exists. What I\'ve tried so far:
// varuId == the ID that is set to the do
To check if document exists in firestore. Trick use .exists method
.exists
Firestore.instance.document('collection/$docId').get().then((onValue){ onValue.exists ? //exists : //not exist ; });