flutter dropdown enum code example
Example: flutter dropdownbutton enum
enum ClassType {A, B, C, D}
return DropdownButton<ClassType>(
value: classType,
onChanged: (ClassType newValue) {
setState(() {
viewModel.classType = newValue;
});
},
items: ClassType.values.map((ClassType classType) {
return DropdownMenuItem<ClassType>(
value: classType,
child: Text(classType.toString()));
}).toList();
);