- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有一个 flutter 应用程序,其中使用 ListView.Builder 生成列表,其中 itemCount 是 firestore 集合中的文档数。在添加新文档之前,这可以正常工作。发生这种情况时,我会收到错误消息(17 和 18 只是示例)。
Invalid value: Not in range 0..17, inclusive: 18
我假设我需要在创建新文档时更新状态,但我不知道发生这种情况时如何调用 setState
这是代码的相关部分:
child: StreamBuilder(
stream: Firestore.instance.collection('contact').orderBy(sortby, descending: decending).snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) return Container();
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) =>
_personer(context, snapshot.data.documents[index], index),
);
},
),
最佳答案
使用设置状态?
StreamBuilder(builder: (context, snapshot) {
return snapshot.hasData == null ? Container() : _getListView(snapshot);
} , )
_getListView(snapshot) {
setState(() {
return ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) =>
_personer(context, snapshot.data.documents[index], index),
);
});
关于flutter - 添加 firestore 文档时更新 ListView.builder itemCount,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57621540/
我对 Azure App Insights 采样有疑问。如果日志项的 itemCount 字段大于 1,是否意味着存在完全相同的请求并且已对其进行采样? 我的日志有一个请求发送此消息,其中 itemC
在 ListCollectionView , 我只是添加新的 GroupDescriptions . 但我正在寻找一种根据 ItemCount 对它们进行排序的方法的组。 所以在第一个位置我会得到最多
我已经尝试了几种不同的方法,但我无法让这个 viewpager 正常运行。我正在设置一个带有适配器的 viewpager2,但部分要求是 viewpager 可以手动滑动以及基于按钮以增加寻呼机 Vi
命名变量的正确方法是什么 int numItems; 对比 int itemCount; 或常数: public static final int MAX_NUM_ITEMS = 64; 对比 pub
很可能我的 SliverGrid 概念完全错了, 我想要做的是,UI 方面我想要 Flutter 中已经提供的可折叠 SliverAppBar。我的主要内容主体是一组来自 API 响应的图像,并且已经
RecyclerView offers a convenient way to preview the layout在 Android Studio 的 Design 选项卡中: tools:item
recyclerView 的 ItemCount 方法是: @Override public int getItemCount() { Log.e("Notification Size is
我基于 PagedListAdapter 实现了分页功能,并且我已经过检查工作正常。我尝试实现以如果 ListAdapter 项为空则显示 EmptyHolder 为特色。在调用 submitList
如果 itemcount属性与索引行数不完全匹配是个问题吗?有没有一种数字方法可以确保我拥有完整的全文索引? 更新:属性(property)fulltextcatalogproperty('datab
我如何才能获得当前的项目数量,即我的 PagingData持有?我找到的唯一解决方案是调用 shopListAdapter.itemCount但这总是返回 0。 我要做的是:获取我的 PagingAd
我正在使用 UICollectionView 和 UICollectionViewDiffableDataSource 并异步和同步获取数据以填充 View 。应用程序崩溃并显示以下消息:“由于未捕获
我正在尝试学习 C 编程,所以我尝试做一些练习。如下所示,搜索函数仅返回 1 或 -1,并且变量索引用于确定目标学生是否存在。但之后它再次被用来确定它是数组中的最后一项、中间项还是第一项。当我们已经将
我有一个 flutter 应用程序,其中使用 ListView.Builder 生成列表,其中 itemCount 是 firestore 集合中的文档数。在添加新文档之前,这可以正常工作。发生这种情
我有一个 flutter 应用程序,其中使用 ListView.Builder 生成列表,其中 itemCount 是 firestore 集合中的文档数。 当我将文档添加到集合中时,我可以通过打印看
我有错误说: "No named parameter with the name 'itemCount'. in Flutter GridView " 任何人都可以帮助解决这个错误。我是 Flutte
我有一个问题,调整我的容器的高度,我希望我的容器的高度取决于它的内容物。然而,容器几乎占据了整个屏幕(不包括应用程序栏和底部导航)。这是我制作的样本片段。。我想要我的容器的底部在我画的黑线上,如果物品
我有一个问题,调整我的容器的高度,我希望我的容器的高度取决于它的内容物。然而,容器几乎占据了整个屏幕(不包括应用程序栏和底部导航)。这是我制作的样本片段。。我想要我的容器的底部在我画的黑线上,如果物品
我正在尝试使用以下代码从 firestore 获取文档: Future getCategories() async { var firestore = Firestore.instance;
我是一名优秀的程序员,十分优秀!