The .values
field of a generated enum class contains the zero-valued unspecified value
#919
Labels
.values
field of a generated enum class contains the zero-valued unspecified value
#919
Given the following
.proto
definition:The official documentation says that:
But the protobuf compiler generates Dart code like this:
which contains all four values, including
COLOR_UNSPECIFIED
.I’m developing a Flutter app where there are many pull-down buttons and the user can only select one of the menu items, which are derived from the enum values. It would be nice if the
.values
list doesn’t contain theXX_UNSPECIFIED
value so that the user must select a meaningful value from the menu. Currently, I have to work around this by excluding the first enum value with.values.sublist(1)
.The text was updated successfully, but these errors were encountered: