我有一個Comment對象,它應該包含評論的子列表,每個子列表也可以包含一個子列表。我希望將其保存到 firebase 數據庫。我該如何構建它?data class Comment constructor( val date : String,
val imageURL : String,
val text : String,
val author : String,
val id : String,
val children : List<Comment>)
2 回答

白豬掌柜的
TA貢獻1893條經驗 獲得超10個贊
在 firebase 名稱中,父節點為 Comment,子節點與屬性名稱相同,即 date、imageUrl、text、author、id 和 children 和 child 的子節點是列表。

天涯盡頭無女友
TA貢獻1831條經驗 獲得超9個贊
有效的解決方案是將孩子保存為String
他們的ID(密鑰)。
data class Comment constructor( val date : String, val imageURL : String, val text : String, val author : String, val id : String, val children : List<String>)
添加回答
舉報
0/150
提交
取消