Plugin for Dart Analyzer to checking enum.toString() usages.
Default Enum.toString() method represent enum constant as class name and constant name (example:
Colors.green but not
green). In some cases this cast is not valid for a program logic (parse values to DB or JSON) and can causing problems (when from DB you get strings without class names,
"green" == Colors.green.toString() is not as we need). Plugin helps to prevent described problem.
How to use
From Dart Analyzer Server
Add plugin as development dependency in
dev_dependencies: dart_enum_to_string_check: git: url: https://github.com/fartem/dart-enum-to-string-check.git ref: master
Add plugin name to
analyzer: plugins: - dart_enum_to_string_check
Then restart Dart Analyzer Server.
Download plugin to your machine and provide
bin/ location to PATH. Then run from project folder:
How to contribute
Read Commit Convention. Make sure your build is green before you contribute your pull request. Then:
$ dart analyze $ dart test
If you don't see any error messages, submit your pull request.
- @fartem as Artem Fomchenkov