Reputation: 2678
How to get value from an object in flutter? i need to display name of products in Text()
List<Object> _dataResponse = [
{"item":"chakka"},
{"item":"manga"},
{"item":"thenga"},
];
ListView(
children: _productName
.map((f) => ListTile(
leading: Icon(Icons.check_circle,color: Colors.green,),
title: **Text('$f["item"]')**,
))
.toList(),
)
Upvotes: 1
Views: 2144
Reputation: 658263
For complex expressions (not just simple identifiers) you need to use ${...}
instead of $...
Text('${f["item"]}')
Upvotes: 1