documentId property

FieldPath get documentId

A special sentinel FieldPath to refer to the id of a document. It can be used in queries to sort or filter by the document id. This is documentId() of the JS SDK.

In a filter on a collection the value is a document id or a DocumentReference; on a collection group it is a full document path.

final QuerySnapshot<Map<String, Object?>> snapshot = await firestore
    .collection('cities')
    .where(FieldPath.documentId, whereIn: ['SF', 'LA'])
    .get();

A getter named documentId (the official spelling) cannot exist next to the method documentId until that method is removed.

Implementation

static FieldPath get documentId => _documentIdInstance;