I'm trying to use a variable in Text Widget, it says Invalid const value, so, I need to use a const, but I'm using Text Widget in a dynamic way. Is there a way to use a Text with variables? or is there another Widget that I could use?
I have something like this:
class PlaceCardState extends StatelessWidget {
PlaceCardState(this._placeCard);
Place _placeCard;
@override
Widget build(BuildContext context) {
return ListTile(
leading: const Icon(Icons.album),
title: Text(_placeCard.title),
subtitle: const Text('Come and dance tonight!'),
);
}
}
place.dart
class Place {
Place([this.title = '', this.description = '', this.image='', this.value=0.0]);
String title;
String description;
String image;
double value;
}
I get this issue:
