I'm trying to change color of Decoration in ListView builder from static List Map values, failed with _castError (type 'String' is not a subtype of type 'Color' in type cast).
What is the correct way to pass color values as Map in Dart with other types of data?
Map:
static const List<Map<String, String>> labels = [
{
'label': 'Water',
'image': 'assets/images/ic_water.png',
'colors': 'Color.fromARGB(255, 100, 216, 221)' tried //255, 100, 216, 221
},
{
'label': 'Food',
'image': 'assets/images/ic_food.png',
'colors': 'Color.fromARGB(255, 100, 216, 221)'
},];
Placement:
ListView.builder(
....
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: ConstantValues.labels[i]['colors']! as Color),
..
)```