docExists method
Used to determined if a document exists based on given id
.
Implementation
Future<bool> docExists({
required String id,
String? collectionPathOverride,
}) async {
assert(
_isCollectionGroup == (collectionPathOverride != null),
'Firestore does not support finding a document by id when communicating with a collection group, '
'therefore, you must specify the collectionPathOverride containing all parent collection and document ids '
'in order to make this method work.',
);
final docRef = findDocRef(id: id, collectionPathOverride: collectionPathOverride);
_log.info('🔥 Checking if document exists with id: $id');
return (await docRef.get()).exists;
}