Samuel Hapak Samuel Hapak - 1 year ago 82
Dart Question

Is there a lint tool to check the code against the Dart style guide?

I would like to write code that conforms to the Dart style guide. Therefore I am curios, whether there is any automatic way to check the coding style for Dart.

Do you know about any way to do this?

Answer Source

Since Dart 1.13 (currently release candidate) you can enable lint checks, strong mode and other features by adding an .analysis_options file to your Dart project (the folder with the pubspec.yaml file)

  strong-mode: true
  - test/data/**
    enableSuperMixins: true
    # see
    - always_declare_return_types
    - always_specify_types
    - camel_case_types
    - constant_identifier_names
    - empty_constructor_bodies
    - implementation_imports
    - library_names
    - library_prefixes
    - non_constant_identifier_names
    - one_member_abstracts
    - package_api_docs
    - package_prefixed_library_names
    - slash_for_doc_comments
    - super_goes_last
    - type_init_formals
#    - unnecessary_brace_in_string_interp
    - unnecessary_getters_setters
    - package_names

The available lint rules are listed in

See also

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download