ktx / com.google.firebase.firestore.ktx / com.google.firebase.firestore.DocumentSnapshot / toObject

toObject

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

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

Parameters

T - The type of the object to create.

Return
The contents of the document in an object of type T or null if the document doesn't exist.

inline fun <reified T> DocumentSnapshot.toObject(serverTimestampBehavior: ServerTimestampBehavior): T?

Returns the contents of the document converted to a POJO or null if the document doesn't exist.

Parameters

T - The type of the object to create.

serverTimestampBehavior - Configures the behavior for server timestamps that have not yet been set to their final value.

Return
The contents of the document in an object of type T or null if the document doesn't exist.