Firestore集合快照不会转换为CSV

时间:2020-02-25 18:22:33

标签: flutter dart google-cloud-firestore

我正在尝试将我的firestore集合转换为csv格式,以便可以通过代码通过电子邮件发送它。 我正在通过以下方式进行操作:

_sendMail() async{
List tempList = await Firestore.instance
        .collection("transactions")
        .snapshots()
        .toList();
    print(tempList.toString());
    final res = const ListToCsvConverter().convert(tempList);
    print(res.toString());
}

异步函数从不打印临时表和res,因此我假设它卡在了集合检索部分。 我知道firestore集合有效,因为我在应用程序的其他部分从中检索文档。

我正在使用csv包转换为需要列表的csv格式:https://pub.dev/packages/csv

有人知道我做错了还是有其他方法做?

1 个答案:

答案 0 :(得分:0)

它没有卡死,即使它处于脱机状态,Firestore也具有脱机模式,不会等待任何事情。 tempList可能为空,这就是为什么看不到任何打印内容的原因。