Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 976
Lymp Avatar asked Apr 28 '16 17:04

Lymp


People also ask

Where is Analysis_options Yaml?

Place the analysis options file, analysis_options. yaml , at the root of the package, in the same directory as the pubspec file.

What is DART analyze?

The dart analyze command performs the same static analysis that you get when you use an IDE or editor that has Dart support. For more information about this and other dart commands, see the Dart command-line tool page.

How do I use Flutter analyzer?

By default, Flutter Analyze is disabled and has to be enabled in App settings > Tests > Static code analysis by checking the Enable Flutter analyzer option.


1 Answers

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

like image 187
Günter Zöchbauer Avatar answered Nov 16 '22 02:11

Günter Zöchbauer