Firestore集合(带有子集合)到Flutter中的Sqflite物品

时间:2020-03-20 07:50:56

标签: sqlite flutter dart google-cloud-firestore sqflite

我的应用程序正在使用Firestore数据库。我通过使用子集合来设计内容的类别及其子类别

启用离线模式功能; 我想将此Firestore数据保存到sqflite数据库。

我了解到我将Firebase数据映射转换为sqlite文本

但是我找不到找到子集合的方法。

 var catagorySnapshots =
        await _firestore.collection("categories").getDocuments();
    List _list = [];
    catagorySnapshots.documents.forEach((_snapshot) {
      CategoryInformation categoryInformation = CategoryInformation();
      CategoryItem curCategory =
          CategoryItem.fromCollection(_snapshot.documentID, _snapshot.data);
      categoryInformation.categoryList.add(curCategory);
      print(curCategory.title);
      //
      // sub collections
      //
    });

enter image description here

1 个答案:

答案 0 :(得分:0)

我知道现在回答还为时已晚,这可能会对其他人有所帮助。 您必须尝试像这样从snapshot.data ['field']获取信息,并将其也隐藏为文本。

让我知道这可行。