google / google/built_value.dart

Support custon names for EnumClass

Open
#920 5 comments 0 reactions 1 assignee Claimed by @davidmorgan View on GitHub
p2 / feature request
Dominant language
Dart
Stars
886
Forks
195
Avg merge
1d 11h
Merged PRs (30d)
4

Description

I need to have an enum for countries, with values like `Mèxico` and just use my enum `Country.mexico` everywhere.

Currently I need to implement a mapper from the string to the enum, and I believe that this could be automatically done if the name of the enums could be customizable and so I can have custom `valueOf` autogenerated too.

# Current
`EnumClass.name` contains the name of the variable itself.

# Expected
I can override name for EnumClass with a custom string.

# Ideas
- Add a variable `name` in the `BuiltValueEnumConst`. that override this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.