toObject

inline fun <T> DocumentSnapshot.toObject(): T?(source)

The document as T, as the Android SDK's reified toObject, through the serializer of T with the Android SDK's rules (FirebaseFormat.Firestore, see firestoreFormat) on every platform, @DocumentId and @ServerTimestamp included; null when the document does not exist. It takes the place of the SDK's reflective toObject(Class) and of the SDK's own reified toObject<T>() (com.google.firebase.firestore.toObject), which is deprecated with an error.


The document as T (see toObject), with the server timestamps resolved as serverTimestampBehavior says.


The document as T (see DocumentSnapshot.toObject); a query document always exists.


The document as T (see DocumentSnapshot.toObject), with the server timestamps resolved as serverTimestampBehavior says.