Invalid constant value
6,930
Have your tried simply returning PopupMenuItem without const
modifier like below?
PopupMenuItem _createMenuItems(final String a) {
return PopupMenuItem(
value: a,
child: Text(a),
);
}
![Sokheang Khun](https://lh6.googleusercontent.com/-hKGp6_3ny8o/AAAAAAAAAAI/AAAAAAAAABM/h_WDMqYRITI/photo.jpg?sz=256)
Comments
-
Sokheang Khun over 1 year
I created a method below to loop through my list because I don't want to write again and again of these few lines but the parameter I pass to the Text widget and also value argument are error and it said Invalid constant value. How can I achieve this? I'm new to flutter. Please help me.
PopupMenuItem _createMenuItems(final String a) { return const PopupMenuItem( value: a, child: Text(a), ); }