首页 > 解决方案 > 不从 Firestore 获取帖子

问题描述

我正在尝试从 firebase 获取最新帖子。但是,它们不会出现在应用程序中。这可能是什么原因?帖子已注册并上传到 Firestore,但不会出现在应用程序中。

@override
Widget build(BuildContext context) {
return ListView(
  shrinkWrap: true,
  padding: EdgeInsets.symmetric(horizontal: 10.0),
  children: [
     if (isBannerAdReady)
        Align(
          alignment: Alignment.topCenter,
          child: Container(
            width: bannerAd.size.width.toDouble(),
            height: bannerAd.size.height.toDouble(),
            child: AdWidget(ad: bannerAd),
          ),
        ),
      StreamBuilderWrapper(
        shrinkWrap: true,
        stream: postRef.orderBy('timestamp', descending: true).snapshots(),
        physics: NeverScrollableScrollPhysics(),
        itemBuilder: (_, DocumentSnapshot snapshot) {
          Review posts = Review.fromJson(snapshot.data());
          return Padding(
            padding: const EdgeInsets.only(bottom: 12.0),
            child: Posts(post: posts),
          );
        },
      ),
  ],
);
}

非常感谢帮助!

编辑:我怀疑它与用户名有关,它是西里尔字母。编辑个人资料并将用户名设置为拉丁字母,它起作用了。为什么?Firebase 不识别西里尔字母?

标签: fluttergoogle-cloud-firestore

解决方案


推荐阅读