Database
Realtime Database, following com.google.firebase.database.core.utilities.encoding.CustomClassMapper.
Numbers: Int, Long, Float and Double, where a Float or Double with an integral value is stored as a Long (
1.0is stored as1); other numbers and Chars are rejected.Collections: Lists, and Maps with String keys; sets, other collections and arrays are rejected.
Enums: the entry's serial name.
Rejected values throw the exception made by exception (the module's
DatabaseException), without a path.A database property without a class property is logged unless the class has
@IgnoreExtraProperties, and fails the read if it has@ThrowOnExtraProperties.
Constructors
Functions
Converts value to plain values by its runtime type, as the Android SDK's mapper does with the Object given to calls such as DocumentReference.set(Object): plain values are checked and copied, the product's own value types are passed through and any other object is encoded with the serializer of its class, which must be @Serializable. The type arguments of a generic class are erased at runtime, so such a value goes through encodeToPlainValue, whose serializer knows them.
Decodes plain values to a T with deserializer, as the Android SDK's mapper does in calls such as DocumentSnapshot.toObject(Class). For Firestore, documentReference is the document that @DocumentId properties receive (its id for a String property); it is ignored by the other products.
Decodes plain values to a T with the serializer of its type, where Any stands for any plain value.
Encodes value to plain values with serializer.
The serializer for type, where Any (as in Map<String, Any?>) stands for the plain value itself, as Object does for the Android mapper: it is decoded as is and encoded by its runtime type. The product's own value types are passed through the same way, and the type arguments of a generic class are resolved by this rule too. So is a type without a serializer of its own, such as the Comparable a map of mixed values infers, unless it is the base of a polymorphic hierarchy registered in the serializersModule.