I want to map a List of Strings to a List of DropdownMenuItems in the Widget constructor. The parent widget passes a List of Strings to the child widget. The child widget must map this List of Strings to a List of DropdownMenuItems. I want to do that in the constructor while keeping the constructor "const". Is that possible? There is a "initState" method for the statefull widgets but I can't find a similar method for the stateless widgets
const SelectableEntry({
Key? key,
required this.dropdownList,
}) : mappedList =
const dropdownList.map((string entry) => DropdownMenuItem<String>(
value: entry,
child: Text(entry),
)).toList(),
super(key: key);
final List<String> dropdownList;
final List<DropdownMenuItem<String>> mappedList;
@override
...