question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin does not use .analysis_options_user file

See original GitHub issue

The Flutter plugin in IntelliJ does not use the analyzer settings in https://github.com/flutter/flutter/blob/master/.analysis_options_user

When running flutter analyze from the command line inside a Flutter project created with the IntelliJ plugin, settings from .analysis_options_user file are used.

When using a project specific .analysis_options file, IntelliJ plugin applies those settings.

Steps to Reproduce

  1. Create a new Flutter project with IntelliJ

  2. Add the following lines of code to lib/main.dart

var list = ["hello", "world"];
List<int> listOfInts = list;
  1. Dart Analysis in IntelliJ does not show any warnings.

  2. In the project folder run flutter analyze. Since strong mode is enabled in .analysis_options_user, the following warning is displayed:

flutter analyze Running ‘flutter packages get’ in learning-flutter… 432ms Analyzing 2 files… [warning] A value of type ‘List<String>’ can’t be assigned to a variable of type ‘List<int>’. (lib/HelloWorld.dart, line 2, col 24) (Ran in 5.8s)

  1. Create an .analysis_options file in the main project folder with the following content:
analyzer:
  strong-mode: true
  1. Dart Analysis panel will show the same warning

ERROR: A value of type ‘List<String>’ can’t be assigned to a variable of type ‘List<int>’. ([learning_flutter] lib/main.dart:4)

Flutter Doctor

[✓] Flutter (on Mac OS, channel master) • Flutter at /Users/raju/dev/flutter • Framework revision 57be959887 (8 hours ago), 2016-11-07 10:03:11 • Engine revision 16077d474b • Tools Dart version 1.21.0-dev.3.0

[✓] Android toolchain - develop for Android devices (Android SDK 24.0.3) • Android SDK at /Users/raju/Library/Android/sdk • Platform android-24, build-tools 24.0.3 • Java™ SE Runtime Environment (build 1.8.0_101-b13)

[✓] iOS toolchain - develop for iOS devices (Xcode 8.1) • XCode at /Applications/Xcode.app/Contents/Developer • Xcode 8.1, Build version 8B62

[✓] IntelliJ IDEA Community Edition (version 2016.2.5) • Dart plugin installed • Flutter plugin installed

[✓] Connected devices

• Lumigon T3 • 30067719 • android-arm • Android 6.0 (API 23)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
danrubelcommented, Mar 28, 2017
1reaction
danrubelcommented, Nov 8, 2016

Addressing issues like this is part of my long arc of work to cleanup the differences between analysis server, dartanalyzer, and flutter analyze.

Read more comments on GitHub >

github_iconTop Results From Across the Web

flutter - analysis_options.yaml the included file not found
I have a flutter package that uses effective_dart which is working as expected. (I've explicitly tested this by adding/removing the include ...
Read more >
Customizing static analysis - Dart
You can use the analysis options file to change the severity of individual rules, or to always ignore some rules. The analyzer supports...
Read more >
analysis_options.yaml - Google Git
https://github.com/flutter/packages/blob/master/analysis_options.yaml. #. # This file contains the analysis options used for code in the flutter/flutter.
Read more >
Use the Analysis ToolPak to perform complex data analysis
If you need to develop complex statistical or engineering analyses, you can save steps and time by using the Analysis ToolPak. You provide...
Read more >
Dart: Files excluded in `analysis_options.yaml` are still ...
The IDE should respect the exclude option in analysis_options.yaml by not warning about analysis errors in excluded files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found