Dart Analyzer is a package that provides a library that performs static analysis of Dart code. It is useful for tool integration and embedding.
Questions tagged [dart-analyzer]
73 questions
21
votes
2 answers
How can I ignore files with dartanalyzer?
I want to ignore all files ending with .g.dart, .inject.dart, .inject.summary in bin/ lib/ and test/
What is the syntax to ignore files dartanalyzer? I tried adding this section to my analysis_options.yaml file:
analyzer:
exclude:
-…

Pacane
- 20,273
- 18
- 60
- 97
14
votes
3 answers
Flutter VS Code Quick Fix not suggesting import
Everything worked fine until a couple of days ago. Whenever I create new widgets or create some files and want to use them, I don't manually type import package:... but start typing the name of that class and press ctrl + . which provided a list of…

kovalyovi
- 1,006
- 1
- 9
- 19
10
votes
1 answer
Why is flutter analyze different from dart analyze?
I am learning Flutter and I've created a simple Android app. I want to follow the best practices, so I've also created a analysis_options.yaml:
include: package:pedantic/analysis_options.yaml
linter:
rules:
public_member_api_docs:…

madhead
- 31,729
- 16
- 153
- 201
10
votes
1 answer
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…

Lymp
- 933
- 1
- 7
- 20
9
votes
2 answers
How to get AppLocalizations import suggestion in Android Studio Quick Fix menu
Problem Statement
Currently, bringing up the Android Studio Quick Fix menu (Opt/Alt+Enter keyboard shortcut) on AppLocalizations does not suggest importing the generated file.
The AppLocalizations class lives at…

chemturion
- 283
- 2
- 16
9
votes
1 answer
Flutter Dart analyzer not applying my linter rules
I'm working on a pretty standard Flutter project. Because I'm new to Flutter and Dart, I'd like my tools to be as helpful as possible. So I added pedantic: ^1.9.0 to dev_dependencies and wrote analysis_options.yaml like this:
include:…

Thomas
- 174,939
- 50
- 355
- 478
9
votes
2 answers
How do I get the AstNode from some Element, in Dart Analyzer / source-gen?
I'm using source_gen to parse some Dart files, through the Dart analyzer.
I'm extending GeneratorForAnnotation<>, and overriding method
FutureOr generateForAnnotatedElement(Element element, ConstantReader annotation, BuildStep…

Marcelo Glasberg
- 29,013
- 23
- 109
- 133
9
votes
1 answer
Suppress hint about use of protected member
The meta package provides a @protected annotation (besides others) to get analyzer hints or warnings about the use of protected members outside of direct subclasses.
INFO: The member 'selectedChildrenChanged' can only be used within instance…

Günter Zöchbauer
- 623,577
- 216
- 2,003
- 1,567
7
votes
2 answers
Asterisk suffix (*) on any Element data type (analyzer >= 0.40.0)
After upgrading to 0.40.0 I started getting an awkward asterisk suffix sign after any type.
Example...
print(elementInstance.type.toString());
I used to get Stream now I'm getting Stream*
Do I miss any analyzer settings or dart…

ddiev
- 81
- 4
6
votes
1 answer
How to check that DartType of Element is custom type?
DartType from analyzer package have some properties:
isDartCoreNum, isDartCoreInt, isDartCoreDouble
How to do check DartType is custom type (DartType represents Employee or Bus NOT int or double)?
This is necessary for I need to discover…

Boris Salimov
- 663
- 2
- 7
- 18
6
votes
1 answer
How to get the subtypes of a generic type using `DartType` from `analyzer` package?
How can I get the subtypes of an element using the class DartType from the analyzer package?
for example if the type is List, I would like to get String. Also will be useful to get if the type is generic.
Another more complex example would…

Luis Vargas
- 2,466
- 2
- 15
- 32
5
votes
1 answer
How do I get the default value of an optional parameter, using Dart's analyzer API?
I'm using Dart's analyzer API, which allows me to introspect Dart code.
Here is some example code:
void soIntense(anything, {bool flag: true, int value}) { }
Notice how the flag parameter has a default value of true.
How can I get the default…

Seth Ladd
- 112,095
- 66
- 196
- 279
4
votes
1 answer
How to get subtypes using `DartType` class from the `analyzer`?
How can I get the subtypes of an element using the class DartType from the analyzer package?

Luis Vargas
- 2,466
- 2
- 15
- 32
3
votes
0 answers
Service for checking Dart/Flutter code like Codebeat or Codacy?
Are there any services for cloud Dart/Flutter code checking like Codebeat or Codacy?

fartem
- 2,361
- 2
- 8
- 20
3
votes
4 answers
The Dart Analyzer could not be started in vscode
I just updated Dart version and then my vscode warning me everytime, "The Dart Analyzer could not be started".
How can i solve this issue ?
Thank's

Robin
- 4,902
- 2
- 27
- 43