颤振火力中的 whereIn 限制

时间:2021-06-04 13:56:36

标签: firebase flutter google-cloud-firestore

我正在构建一个应用程序,我试图在当前用户关注的人的提要页面中显示所有帖子。 它运行良好,但我的问题是 WhereIn 限制.. 如何在 FutureBuilder 中规避此限制?

代码如下:

buildFeed() {
    return FutureBuilder(
      future: storiesRef
          .where('uid', whereIn: widget.userIds)
          .orderBy('timeStamp', descending: true)
          .get(),
      builder: (context, snapshot) {
        if (!snapshot.hasData) {
          return loading();
        }
        final stories = snapshot.data.docs;
        List<StoryTickets> tickets = [];
        for (var story in stories) {
          List<String> categories = List.from(story.data()['categories']);
          StoryTickets ticket = StoryTickets(
            displayName: story.data()['displayName'],
            categories: categories,
            storyId: story.data()['sid'],
            commentId: story.data()['cid'],
            ownerId: story.data()['uid'],
            rating: story.data()['rating'].toString(), //TODO: maybe delete
            storyPhoto: story.data()['storyPhoto'],
            timestamp: story.data()['timeStamp'],
            title: story.data()['title'],
          );
          tickets.add(ticket);
        }
        return ListView(
          children: tickets,
        );
      },
    );
  }

0 个答案:

没有答案