I have the following code:
_places.forEach((element) {
final String name = element.name;
print(element);
places.add(Card(
child: InkWell(
splashColor: Colors.blue.withAlpha(30),
onTap: () {
print('Card tapped.');
},
child: const SizedBox(
width: 375,
height: 100,
child: Padding(
padding: EdgeInsets.all(15.00),
child: Text(
name
)
)))));
});
The problem I'm having is that the variable name is giving an error when using it inside Text.
Error: Not a constant expression.