[英]firebase document some fields are showing as null when map and array exist in the document
At first glance, I can see that the names of the fields in your Orders
class are different than the names that exist in the database.乍一看,我可以看到您的
Orders
class 中的字段名称与数据库中存在的名称不同。 In your class, the fields start with an upper-case letter, while in the database start with a lower-case letter.在您的 class 中,字段以大写字母开头,而在数据库中以小写字母开头。 And this is not correct, the names must match.
这是不正确的,名称必须匹配。 The simplest solution would be to change the names of the fields in the class. So a field called
OrderNo
should be changed to orderNo
.最简单的解决方案是更改 class 中字段的名称。因此应将名为
OrderNo
的字段更改为orderNo
。 See the lower-case o
?看到小写的
o
了吗?
Alternatively, you can use an annotation like this:或者,您可以使用这样的注释:
@get:PropertyName("orderNo")
@set:PropertyName("orderNo")
var OrderNo: String? = null,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.