DocumentReference class

A DocumentReference refers to a document location in a FirebaseFirestore database and can be used to write, read, or listen to the location.

The document at the referenced location may or may not exist. A DocumentReference can also be used to create a CollectionReference to a subcollection.


firestore FirebaseFirestore
The Firestore instance associated with this document reference.
hashCode int
The hash code for this object. [...]
read-only, override
id String
This document's given ID within the collection.
parent CollectionReference
The parent CollectionReference of this document.
path String
A string representing the path of the referenced document (relative to the root of the database).
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


collection(String collectionPath) CollectionReference
Gets a CollectionReference instance that refers to the collection at the specified path, relative from this DocumentReference.
delete() Future<void>
Deletes the current document from the collection.
get([GetOptions options]) Future<DocumentSnapshot>
Reads the document referenced by this DocumentReference. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
set(Map<String, dynamic> data, [SetOptions options]) Future<void>
Sets data on the document, overwriting any existing data. If the document does not yet exist, it will be created. [...]
snapshots({bool includeMetadataChanges = false}) Stream<DocumentSnapshot>
Notifies of document updates at this location. [...]
toString() String
A string representation of this object. [...]
update(Map<String, dynamic> data) Future<void>
Updates data on the document. Data will be merged with any existing document data. [...]


operator ==(dynamic o) bool
The equality operator. [...]