首页 > 解决方案 > 如何根据 dart 中另一个 Stream 的数据创建一个新的 Stream?

问题描述

我创建了一个流,它返回包含 Firestore 中特定字段的特定文档列表。基于此 Stream,我想创建另一个使用第一个流中的数据的流,以从 Firestore 中检索一些其他数据。这怎么可能?

这是流

Stream<List<EsportsMatch>> get csgoMatches {
  String formattedDate = DateFormat('yyyy-MM-dd').format(DateTime.now());

  print(formattedDate);

  return db
      .collection("matches")
      .where("@type", isEqualTo: "CS GO")
      .snapshots()
      .map((_csgoMatchesFromSnapshot));
}

标签: flutterdartstream

解决方案


推荐阅读