【问题标题】:How to do this for Firebase in Flutter如何在 Flutter 中为 Firebase 执行此操作
【发布时间】:2021-08-11 19:10:37
【问题描述】:

我想在我的代码中将文档的长度显示为像这样的特定集合中的文本。

我想在 Flutter 中显示“Agung”中有多少文档 this is the ss of my Firebase

【问题讨论】:

    标签: firebase flutter google-cloud-firestore


    【解决方案1】:

    我认为这个问题已经回答了here

    显示您可以使用 Agung 中的文档数量:

    int countDocuments() async {
            QuerySnapshot _myDoc = await Firestore.instance.collection('Agung').getDocuments();
            List<DocumentSnapshot> _myDocCount = _myDoc.documents;
            return _myDocCount.length;  // Count of Documents in Collection
        }
    

    然后你可以调用函数并将结果放在你的文本小部件上

    【讨论】:

    • @ShinnKun 太好了!如果您接受我的回答,将不胜感激
    猜你喜欢
    • 2010-10-03
    • 2011-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-30
    • 2011-12-29
    • 2011-11-21
    相关资源
    最近更新 更多