Invalid constant error message for item.header.
It is a boolean value representing if the list tile is going to have a bold or normal font-weight.
child: ListTile(
key: ValueKey(item.stuffId),
title: Text(
item.name,
style: const TextStyle(
color: Colors.blue,
fontWeight: item.header == true ? FontWeight.bold : FontWeight.normal,
),
),
Here is the list that I used:
final List<Stuff> _items = [
Stuff(stuffId: "1", name: "Toiletries", header: true),
Stuff(stuffId: "2", name: "Toothpaste", header: false),
Stuff(stuffId: "3", name: "Hair brush", header: false),
Stuff(stuffId: "4", name: "Nail clippers", header: false),
];
'Toiletries' is the header and therefore supposed to be bold.
ListTile(
key: ValueKey(item.stuffId),
title: Text(
item.name,
style: TextStyle( // 👈 remove const here
color: Colors.blue,
fontWeight: item.header == true ? FontWeight.bold : FontWeight.normal,
),
),