I could not find FieldPath
in the cloud_firestore Flutter plugin, however, I would assume that this is a very common tool that would be one of the first impleme
I actually forgot about this, but I added FieldPath.documentId as part of a pull request to cloud_firestore
at some point.
This means that you can simply use it like this:
Firestore.instance.collection('movies').orderBy('rating').orderBy(FieldPath.documentId);
__name__
works if you want to target the document id.
You can use '__name__'
as a String
, which is equivalent to FieldPath.documentId()
.
String fieldPathDocumentId = '__name__';
Firestore.instance.collection('movies').orderBy('rating').orderBy(fieldPathDocumentId);
This works for me. (I am not sure this is what you wanted.)
Firestore.instance.collection('/collection-name')
.where(FieldPath.documentId, isEqualTo: _someID)
.snapshots().listen((snapshots){
/*
*/
});