Plugin does not use .analysis_options_user file
See original GitHub issueThe 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
-
Create a new Flutter project with IntelliJ
-
Add the following lines of code to lib/main.dart
var list = ["hello", "world"];
List<int> listOfInts = list;
-
Dart Analysis in IntelliJ does not show any warnings.
-
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)
- Create an
.analysis_options
file in the main project folder with the following content:
analyzer:
strong-mode: true
- 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:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
This should be fixed as of https://github.com/flutter/flutter/commit/52245e5082d70e089d6b9460a681849000de2340 to use the analysis options in package:flutter/analysis_options_user.yaml.
Please re-open if this is not the case.
Addressing issues like this is part of my long arc of work to cleanup the differences between analysis server, dartanalyzer, and flutter analyze.