DocumentReference<T extends Object?> class abstract

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.

Annotations

Constructors

DocumentReference()

Properties

firestore FirebaseFirestore
The Firestore instance associated with this document reference.
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
This document's given ID within the collection.
no setter
parent CollectionReference<T>
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<Map<String, dynamic>>
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<T>>
Reads the document referenced by this DocumentReference.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(T 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<T>>
Notifies of document updates at this location.
toString() String
A string representation of this object.
inherited
update(Map<Object, Object?> data) Future<void>
Updates data on the document. Data will be merged with any existing document data.
withConverter<R>({required FromFirestore<R> fromFirestore, required ToFirestore<R> toFirestore}) DocumentReference<R>
Transforms a DocumentReference to manipulate a custom object instead of a Map<String, dynamic>.

Operators

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