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
Use the exists method on the snapshot:
final snapShot = await Firestore.instance.collection('posts').document("docID").get(); if (snapShot.exists){ //it exists } else{ //not exists }