Cloud Firestore中的PropertyName不适用于Kotlin [英] PropertyName in Cloud Firestore does not work with Kotlin

查看:77
本文介绍了Cloud Firestore中的PropertyName不适用于Kotlin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注释@PropertyName在Kotlin中未序列化!

The annotation @PropertyName is not serialized in Kotlin!

版本:com.google.firebase:firebase-firestore:17.1.0

Version: com.google.firebase: firebase-firestore: 17.1.0

仅在我使用注释@JVMField或在Java中创建相同的类时,才在Kotlin Android项目中使用@PropertyName,它不会序列化该值.

Using @PropertyName in a Kotlin Android project, it does not serialize the value, only when I use annotation @JVMField or create the same class in Java.

@JvmField
@PropertyName("championship-name")
val championshipName: String = "",

推荐答案

尝试这样

@get:PropertyName("championship-name") @set:PropertyName("championship-name") var championshipName: String = "",

这篇关于Cloud Firestore中的PropertyName不适用于Kotlin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆