首页 > 解决方案 > How to control listviewbuilder from outside the listview in flutter?

问题描述

How to control listviewbuilder from outside the listview in flutter?

In a textfield I can use a controller like so: controller: Textcontroller. Can I do something similar in listviewbuilder to clear all the objects in it?

标签: flutter

解决方案


所以准确地说。我的代码看起来像这样

 Expanded(
                child: new ListView.builder(

                  itemCount: List.length,
                  itemBuilder: (context,index){

                 

                    return new Card(

                     //all stuff with data
                        ),
                      ),
                    );
                  },

……

我将如何实现 StatefulBuilder 或更改它的状态,就像评论中的人写的那样?


推荐阅读