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.

Properties

firestore FirebaseFirestore
The Firestore instance associated with this document reference.
final
hashCode int
The hash code for this object.
no setteroverride
id String
This document's given ID within the collection.
no setter
parent CollectionReference
The parent CollectionReference of this document.
no setter
path String
A string representing the path of the referenced document (relative to the root of the database).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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 nonexistent method or property is accessed.
inherited
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.
override
update(Map<String, dynamic> data) Future<void>
Updates data on the document. Data will be merged with any existing document data.

Operators

operator ==(Object other) bool
The equality operator.
override