Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

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();
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flutter #dropdownbutton #enum
ADD COMMENT
Topic
Name
8+1 =