I have a simple class like this:
class Restaurant{
final String id;
final String name;
List<Serving> servingList;
Restaurant({
required this.id,
required this.name,
this.servingList = [], // ERROR
});
}
By default I want an empty List for servingList
and add Objects to this List later. But I get the error The default value of an optional parameter must be constant.
What do I need to do?
I appreciate every help, thanks!