Drop "is" prefix for Firebase Firestore fields for Boolean Values
11:18 20 Sep 2020

When using custom Kotlin objects for firestore drop 'is' prefix. It ruined my entire day.

data class UberRequest(val geoPoint: GeoPoint? = null,
                   
                   //don't use 'is' prefix on boolean properties
                   val isAccepted:Boolean = false,
                   @ServerTimestamp
                   val timestamp: Date? = null)

I noted on the console that 'is' is dropped as shown on this snapshot from firestore console enter image description here

So when you try to retrieve the isAccepted value it returns the default value which in this case is false. If the default value is null, you get a null value back

This is illustrated on this snapshot from my logcat

enter image description here


I noted on the console that 'is' is dropped as shown on this snapshot from firestore console enter image description here

So when you try to retrieve the isAccepted value it returns the default value which in this case is false. If the default value is null, you get a null value back

This is illustrated on this snapshot from my logcat

enter image description here

android firebase kotlin google-cloud-firestore