dartdart-analyzer

How to set up strong-mode Dart Analyzer in Webstorm?


In my Dart yaml file I have

analyzer:
  strong-mode: true

but it doesn't do anything. I also added the analyzer:

dependencies:
   analyzer: any
   browser: ^0.10.0
   polymer: ^1.0.0-rc.16
   polymer_elements: ^1.0.0-rc.8

I'm missing something (brain I reckon). What is it please?

Thanks

Steve


Solution

  • Add a file analysis_options.yaml (.analysis_options old) in the directory where your pubspec.yaml is.

    add

    analyzer:
      strong-mode: true
    

    or if you also want to disable implicit-casts and/or implicit-dynamic

    analyzer:
      strong-mode:
        implicit-casts: false
        implicit-dynamic: false
    

    You can also enable additional linter rules

    linter:
      rules:
        - always_declare_return_types
    

    For all supported linter rules see http://dart-lang.github.io/linter/lints/ and Suppress hint about use of protected member

    See also https://www.dartlang.org/guides/language/analysis-options