DocumentSnapshot<T> class

A DocumentSnapshot is an immutable representation for a document in a Firestore database. The data can be extracted with data.

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.

Implementers
Annotations
  • @immutable

Constructors

DocumentSnapshot.fromUpdateMap(DocumentReference<T> ref, UpdateMap data)
factory

Properties

createTime Timestamp?
final
exists bool
True if the document exists.
no setter
hashCode int
The hash code for this object.
no setteroverride
id String
The ID of the document for which this DocumentSnapshot contains data.
no setter
readTime Timestamp?
final
ref DocumentReference<T>
A DocumentReference for the document stored in this snapshot.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
updateTime Timestamp?
final

Methods

data() → T?
Retrieves all fields in the document as an object. Returns 'undefined' if the document doesn't exist.
get(Object field) Optional<Object?>?
Retrieves the field specified by field.
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.
override