I want to use refresh indication in flutter futurebuilder. I looked for the solutuion but but not worked in my case. I have provided my code below. I found a solution where they suggested to use the stack but that solutiion not worked either.
column(children:[
...
const Heading("New Workers !"),
FutureBuilder(
future: SupervisorServices.getWorkersList(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
var data = snapshot.data;
if (snapshot.hasData) {
return RefreshIndicator(
onRefresh: () {
return SupervisorServices.getWorkersList();
},
child: ListView.builder(
itemCount: data.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Card(
child: ListTile(
leading: const SizedBox(
height: double.infinity,
child: Icon(
FeatherIcons.user,
),
),
//...
),
),
);
},
),
);
}
...//rest code
},
),
...
Try add async
onRefresh: () async{
return SupervisorServices.getWorkersList();
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.