I only want my iconButton to show if there is more info on my row.
What is the correct way to code this? My if has red error mark on it.
if(item.info != ""){
child: IconButton(
icon:
const Icon(Icons.info_outline_rounded),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Page2()));
}, //onPressed
), //IconButton
}, //end if statement
), //Center
2
Answers
or with Visibility widget
And if you do not want to add unnecessary widget while condition is false. You can try this
If condition will false then it will not render any widget.