I only want the values greater than 0 to be visible. It gives the following error, how can I fix it? Because if I don’t do it this way, if I use else and suppress SizedBox(), CupertinoListSection shows empty divider.
Statements in an if should be enclosed in a block. (Documentation)
Try wrapping the statement in a block.
FutureBuilder(
future: item.assetCountAsync,
builder:
(BuildContext context, AsyncSnapshot<int> snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const SizedBox();
} else {
if(snapshot.data != null && snapshot.data! > 0) // snapshot.data! > 0
return CupertinoListTile.notched(
onTap: () {
Navigator.pop(context, item);
},
title: Text(item.name),
additionalInfo: Text(snapshot.data.toString()));
}
},
)