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

Extensions for com.google.firebase.firestore.DocumentSnapshot

getField

fun <T> DocumentSnapshot.getField(field: String): T?
fun <T> DocumentSnapshot.getField(    field: String,     serverTimestampBehavior: ServerTimestampBehavior): T?
fun <T> DocumentSnapshot.getField(fieldPath: FieldPath): T?
fun <T> DocumentSnapshot.getField(    fieldPath: FieldPath,     serverTimestampBehavior: ServerTimestampBehavior): T?

Returns the value at the field, converted to a POJO, or null if the field or document doesn't exist.

toObject

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

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