David Morgan ☯
2015-08-26 11:51:15 UTC
Hi Dartisans,
For those who like a bit of class in their enums, or a bit of enum in their
classes, a tool:
https://github.com/google/enum_class.dart
You write a class, declare the constants, and it generates the boilerplate
needed for enum-like behaviour.
Example class that you write:
https://github.com/google/enum_class.dart/blob/master/example/lib/test_enum.dart
Example generated code:
https://github.com/google/enum_class.dart/blob/master/example/lib/test_enum.g.dart
Example project structure, note the "tools/build.dart":
https://github.com/google/enum_class.dart/tree/master/example
The source_gen library is still bleeding edge, you'll need to be on SDK
1.12 to use enum_class.
Feedback welcome! I'm really interested in whether people find this useful
and how we can make it more usable.
Although the implementation is bleeding edge, the idea is well tested: we
have a similar tool and over a hundred of these semi-generated enums on my
(Google internal) project.
Cheers
Morgan
For those who like a bit of class in their enums, or a bit of enum in their
classes, a tool:
https://github.com/google/enum_class.dart
You write a class, declare the constants, and it generates the boilerplate
needed for enum-like behaviour.
Example class that you write:
https://github.com/google/enum_class.dart/blob/master/example/lib/test_enum.dart
Example generated code:
https://github.com/google/enum_class.dart/blob/master/example/lib/test_enum.g.dart
Example project structure, note the "tools/build.dart":
https://github.com/google/enum_class.dart/tree/master/example
The source_gen library is still bleeding edge, you'll need to be on SDK
1.12 to use enum_class.
Feedback welcome! I'm really interested in whether people find this useful
and how we can make it more usable.
Although the implementation is bleeding edge, the idea is well tested: we
have a similar tool and over a hundred of these semi-generated enums on my
(Google internal) project.
Cheers
Morgan
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.