Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how Enum Classes differ from dart 2.17 enhanced enums with members #1171

Open
TzviPM opened this issue Jun 28, 2022 · 4 comments
Open

Comments

@TzviPM
Copy link
Contributor

TzviPM commented Jun 28, 2022

See annaouncement post from Dart 2.17 which details changes for "Enhanced enums with members": https://medium.com/dartlang/dart-2-17-b216bfc80c5d#:~:text=Enhanced%20enums%20with%20members

The documentation for built_value still mentions:

For an object oriented design, though, enums need to be classes. Dart falls short here, so Enum Classes provide what's missing!

This remark seems outdated. That said, it does seem that EnumClasss are still relevant for serializability (see #1147 (comment)).

The documentation should be updated to clarify the feature overlap and why EnumClass is still relevant. Furthermore, if dart's implementation could make serializability possible without EnumClass, then an issue should be opened in dart-lang itself and one here to track any upstream changes and deprecate EnumClass.

Please let me know if I can help with taking ownership of these changes and pushing them forward.

@TzviPM
Copy link
Contributor Author

TzviPM commented Jun 28, 2022

cc @davidmorgan for context

@phamnhuvu-dev
Copy link

I also need it

@davidmorgan
Copy link
Collaborator

I'm currently looking at changes needed for Dart 3; that will likely happen before I get a chance to look at enhanced enums, unfortunately.

@TzviPM
Copy link
Contributor Author

TzviPM commented Mar 24, 2023

I was just thinking about that too. Specifically, sealed classes could probably be generated for union types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants