Flutter SteamBuilder在退货前暂停

问题描述

我试图从数据库获取数据并将其放入listbuilder中,然后再将数据转换为List。当我运行代码时,它会在返回之前暂停,当我单击继续时,它会正常工作。在CallStack上显示为“暂停”,但没有错误

这是构建中的数据库调用(窗口小部件):

CollectionReference mbNotes =
    FirebaseFirestore.instance.collection('dbShortNotes');
List<ShortNoteItem> notes = [];

这是我的构建代码(小部件):

 Expanded(
        child: StreamBuilder<QuerySnapshot>(
            stream: mbNotes.snapshots(),builder: (context,AsyncSnapshot<QuerySnapshot> snapshot) {
              if (snapshot.hasError) {
                return Text('Something went wrong');
              }

              if (snapshot.connectionState == ConnectionState.waiting) {
                return Text("Loading");
              }
              

//它在这里停止,我需要单击继续

                snapshot.data.docs.asMap().forEach((index,f) {
                notes.add(ShortNoteItem(
                    author: f.data()['author'],title: f.data()['title'],category: f.data()['category'],createdDate: f.data()['createdDateTime'],createdTime: f.data()['createdDateTime'],tags: f.data()['tags']));
              });

              return GroupedListView<ShortNoteItem,String>(
                collection: notes,controller: controller,groupBy: (ShortNoteItem sNote) => formatDate(
                    sNote.createdDate.toDate(),[dd,'.',mm,yyyy]),listBuilder: (BuildContext context,ShortNoteItem sNote) =>
                    ListTile()

我不知道我在做什么错。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...