简体   繁体   English

如何在 Firebase 数据库中嵌套数据?

[英]How can I nest data in Firebase Database?

I would like to created a nested file for firebase database that nests as follows:我想为 firebase 数据库创建一个嵌套文件,嵌套如下:

Category{
      Main{
       Books{
     Literature{
     Name: "American Origin",
     Author: "James Odla"
               }
            }
         }
     }
}

If you are using for example StreamBuilder and ListView.builder() for getting the categories snapshots if your stream is => Firestore.instance.collection("categories").snapshots() you should be able to get the category which is clicked => snapshot.data.documents[index] and the items => snapshot.data.documents[index]['items'] .如果您使用例如StreamBuilderListView.builder()来获取类别快照,如果您的 stream 是 => Firestore.instance.collection("categories").snapshots()您应该能够获得被点击的类别 = > snapshot.data.documents[index]和 items => snapshot.data.documents[index]['items']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM