Because last Dart version supports name parameter this plugin is recommended to use on old Dart revisions.
Plugin for Dart Analyzer to check enum.toString() usages.
Default enum.toString() method represents an enum constant as class name + constant name (for example, when we
call color.toString() we have Colors.green but
not green). In some cases this cast is not valid for an app logic (parse values to DB or JSON and vice versa) and
can causing some problems (when from DB you get a strings without class names, "green" == Colors.green.toString() is
not as we need). Plugin helps to prevent described problem.
Add plugin as development dependency in pubspec.yml:
dev_dependencies:
dart_enum_to_string_check: ^0.8.3Add plugin to analysis_options.yaml:
analyzer:
plugins:
- dart_enum_to_string_checkThen restart Dart Analyzer Server.
To get dart_enum_to_string_check from pub run:
$ dart pub global activate dart_enum_to_string_checkThen run from project folder:
$ dart_enum_to_string_checkDownload plugin to your machine and provide bin/ location to PATH. Then run from project folder:
$ dart dart_enum_to_string_check.dartSolutions from dart-code-metrics by Wrike:
Read Commit Convention. Make sure your build is green before you contribute your pull request. Then:
$ dart analyze
$ dart testIf you don't see any error messages, submit your pull request.
- @fartem as Artem Fomchenkov