Enum Classes are an extension to Dart that uses code generation to give common enum functionality to classes.
toString, can be used in
switchstatements, and are real classes that you can add code to
valuesmethod that returns all the enum values in a
valueOfmethod that takes a
Enum Classes use the source_gen
library for code generation. The typical way to use it is via a
tool that you create for your project. When you run it, all the generated files
Here's what you need to do to use Enum Classes:
build.dartfor your project. See example, below.
pub run tools/build.dartwhenever you need to update the generated files.
package:enum_class/enum_class.dartthen extend EnumClass.
for a full project with a
build.dart and an enum.
Please file feature requests and bugs at the issue tracker.
Add this to your package's pubspec.yaml file:
dependencies: enum_class_generator: ^0.1.0
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|2.0.0||Nov 22, 2016|
|1.1.2||Nov 14, 2016|
|1.1.1||Oct 19, 2016|
|1.1.0||Sep 21, 2016|
|1.0.0||Jul 11, 2016|
|0.2.2||Jun 7, 2016|
|0.2.1||Jun 6, 2016|
|0.2.0||May 30, 2016|
|0.1.0||May 25, 2016|
|0.0.6||Oct 23, 2015|