DocumentSnapshot extension type

A DocumentSnapshot contains data read from a document in your Firestore database. The data can be extracted with .data() or .get(<field>) to get a specific field.

For a DocumentSnapshot that points to a non-existing document, any data access will return 'undefined'. You can use the exists property to explicitly verify a document's existence.

on
Implemented types
Implementers
Available extensions

Properties

createTime Timestamp?
The time the document was created. Not set for documents that don't exist.
no setter
exists bool
True if the document exists.
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
The ID of the document for which this DocumentSnapshot contains data.
no setter
readTime Timestamp
The time this snapshot was read.
no setter
ref DocumentReference
A DocumentReference to the document location.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
updateTime Timestamp?
The time the document was last updated (at the time the snapshot was generated). Not set for documents that don't exist.
no setter

Methods

data() JSObject
Retrieves all fields in the document as an Object. Returns 'undefined' if the document doesn't exist.
get(JSAny fieldPath) JSObject
Retrieves the field specified by fieldPath.
isEqual(DocumentSnapshot other) bool
Returns true if the document's data and path in this DocumentSnapshot is equal to the provided one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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