加载刷新小部件后,屏幕上小部件上应显示的值列表不会更新。是什么原因造成的?通过热重载,它会更新,但是当手动强制该值时,它不会随下拉列表更新。
颤振代码:
RefreshIndicator(
onRefresh: () async {
setState(() async {
lista= await getList(context);
});
},
child: Container(
child: ListView.builder(
shrinkWrap: true,
itemCount: lista.length,
itemBuilder: (BuildContext context, int index) {
return getRow(lista[index]);
})),
),
更改刷新部分,如下所示
onRefresh: () async {
var listItems = await getList(context);
setState(() {
lista = listItems ;
});