build(BuildContext context) {
return Scaffold(
...,
body: Center(
child: FutureBuilder<List<Model>>(
future: DBHelper.instance.getItems(),
builder: (BuildContext context, AsyncSnapshot<List<Model>> snapshot) {
if (!snapshot.hasData) {
return Container();
}
return snapshot.data!.isEmpty
? Container()
: ListView(
children: snapshot.data!
.where((item) => true)
.map((item) => Model(
id: item.id,
title: item.title,
...,
))
.toList(),
);
}
),
),
);
}
Widget