I want to change icons based on information fetched from the database. How can I do that?
if(documentSnapshot['visiting period']=="Sold"){
Icon(MyIcons.aquas),
},
else{
...
}
Can anyone help with this as I get the error
The element type 'List<Icon>' can't be assigned to the list type 'Widget'.
4
Answers
You can use ternary operator inside the icon widget like this
replace true with your condition.
the value after ? will be called if the condition is true and the value after : will be called when condition is false
You can achieve that using two way.
Or
Try this
You can create a method that returns an icon.
If you dont want an icon as default you can return container();