DocumentReference extension type
A DocumentReference
refers to a document location in a Firestore 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.
- on
- Implemented types
- Available extensions
Properties
- firestore → Firestore
-
The
Firestore
for the Firestore database (useful for performing transactions, etc.).no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The identifier of the document within its collection.
no setter
- parent → CollectionReference
-
A reference to the Collection to which this DocumentReference belongs.
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. -
create(
JSObject data) → JSPromise< WriteResult> -
Creates a document referred to by this
DocumentReference
with the provided object values. The write fails if the document already exists -
delete(
[Precondition precondition]) → JSPromise< WriteResult> -
Deletes the document referred to by this
DocumentReference
. -
get(
) → JSPromise< DocumentSnapshot> -
Reads the document referred to by this
DocumentReference
. -
isEqual(
DocumentReference other) → bool -
Returns true if this
DocumentReference
is equal to the provided one. -
listCollections(
) → JSPromise< JSArray< CollectionReference> > - Fetches the subcollections that are direct children of this document.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onSnapshot(
JSFunction onNext, [JSFunction onError]) → void - Attaches a listener for DocumentSnapshot events.
-
set(
JSObject data, [SetOptions options]) → JSPromise< WriteResult> -
Writes to the document referred to by this
DocumentReference
. If the document does not yet exist, it will be created. If you passSetOptions
, the provided data can be merged into an existing document. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
JSObject data, [Precondition precondition]) → JSPromise< WriteResult> -
Updates fields in the document referred to by this
DocumentReference
. The update will fail if applied to a document that does not exist. -
updateFieldPath(
JSAny field, JSObject value, [JSArray< JSAny> precondition]) → JSPromise<WriteResult> -
Updates fields in the document referred to by this
DocumentReference
. The update will fail if applied to a document that does not exist. -
withConverter(
FirestoreDataConverter? converter) → DocumentReference -
Applies a custom data converter to this DocumentReference, allowing you
to use your own custom model objects with Firestore. When you call
set(), get(), etc. on the returned DocumentReference instance, the
provided converter will convert between Firestore data of type
NewDbModelType
and your custom typeNewAppModelType
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited