I have an array that has an image URL and normal string as its content. I want to display an image or Text widget based on which value is being read. I have used this to make that work:
Widget build(BuildContext context) {
final usrMap = {"tom", 'tom.png', "taommy"};
return MaterialApp(
title: 'Flutter Tutorial',
home: Scaffold(
appBar: AppBar(
title: Text('Flutter Text Widget Tutorial'),
),
body: Column(
children: [
for( var prop in usrMap){
prop.contains(".com")? Text(prop) : Text("not .png")
},
]
),
),
);
}
I am getting this error The element type 'Set' can't be assigned to the list type 'Widget' How do I fix this?