Questions tagged [dart-analyzer]

Dart Analyzer is a package that provides a library that performs static analysis of Dart code. It is useful for tool integration and embedding.

Links

73 questions
0
votes
1 answer

Find function/method body explicit dependency types using Dart analyzer package

I would like to understand how can I analyze methods / functions body to find types that are explicitly referenced from it. I have success analyzing method declaration (return type, parameter types, etc..), however I have no idea how to do that for…
Alex Radzishevsky
  • 3,416
  • 2
  • 14
  • 25
0
votes
1 answer

How to migrate codebase to strict mode gradually?

Recently I joined project with low quality codebase and I want to set analyzer to strong-mode and set a bunch of strict linter rules. But when I did that, I get more than 3K errors. I can't rewrite all codebase at once. Is there is a way to set new…
ivanesi
  • 1,603
  • 2
  • 15
  • 26
0
votes
0 answers

Dart Analysis Server client: couldn't create connection to server

I opened the flutter project I'm working on and find this error message. Code completion is not working, no warning of any sort is displayed if I make mistakes/errors in my code. No red line is drawn under my code if I miss something on the line. In…
0
votes
1 answer

Flutter - Exclude specific linter rule in analysis_options.yaml for a folder

I have a bigger project with different rules for the linter written down in the analysis_options yaml file. I want to exclude a subset of rules for certain folders. Example: I want to exclude the hole "lib/application" folder for the rule…
0
votes
0 answers

analyzer_plugin generates Legacy protocol of Dart analyzer server instead of LSP

I try to write some custom lint rules. To achieve this, I used the analyzer_plugin package and I set up my project as it should be. Here is a simplified excerpt of the main class : class LintAnalyzerPlugin extends ServerPlugin { @override …
0
votes
2 answers

Flutter custom linter option to ban setState

I would like to write a new custom linter rule. Especially, I want to write a rule that forbids the use of the setState function in flutter. Is there any solution to customize your linter rules out there?
0
votes
2 answers

In Android Studio For Mac context Actions are not being displayed

I have tried to enable the context actions in android studio but am not able to find any suggestions. when I press option + enter Checked in settings > intentions > Dart analysis still no use Checked in settings > preferences > Keymap it is still…
0
votes
3 answers

Avoid "value can be null" warning for extension method

I am using an extension on Iterable that adds the following two methods extension MyIterableExt on Iterable { bool get isEmptyOrNull => this == null || this.isEmpty; bool get isNotEmptyOrNull => this != null && this.isNotEmpty; } This…
Magnus
  • 17,157
  • 19
  • 104
  • 189
0
votes
3 answers

What does too many positional argument mean in Flutter?

Dart Analysis Toolbar When I wrote this code in Android Studio, that is what came up in my dart analysis toolbar: The code I wrote How do I prevent this?
0
votes
1 answer

Flutter: code analysis and layout explorer in code at build time

I'm new to flutter, so I hope my question will not be too much out of scope: I would like to extract meta informations about the app at build time. The idea is to have JSON tree of the app widgets and send it to an external database via API call for…
TOPKAT
  • 6,667
  • 2
  • 44
  • 72
0
votes
1 answer

How can I disable all lints in a file?

I have a file in my project that breaks many lint rules, and I cannot make major changes to it. How can I disable all lints within this file?
hacker1024
  • 3,186
  • 1
  • 11
  • 31
0
votes
1 answer

Dart AST library fails when compiled

I'm building a program that use the Dart's AST library, and it works fine as long as I use the Dart interpreter to run the program (dart filename.dart). Once I want to compile the program (dart compile filename.dart), the program can't load the file…
Axel.A
  • 94
  • 1
  • 9
0
votes
1 answer

Dart analysis often freeze on android studio

Dart analysis often freeze on android studio. So, quick doc and code completion didn't work. I have tried to restart android studio, delete file on folder .dartServer, downgrade dart plugin and flutter plugin version, downgrade flutter sdk, disable…
0
votes
1 answer

how to get annotations defined on a type from TypeAnnotation dart analyzer

I want to get TypeAnnotation source to get annotations defined on that type // file1.dart @Annoation(name :"hello") class RType { } // file2.dart @Selectors() class Example { static Rtype hello() => null; } by using ast visitor i…
invariant
  • 8,758
  • 9
  • 47
  • 61
0
votes
0 answers

Extend Dart analyzer features

I'm currently building a framework on Dart and would like to throw static errors and warnings for the user on the 'Problems' tab on VS Code. If not possible, throw warnings based on annotations would be very helpful, like the meta package. I more or…
rdnobrega
  • 721
  • 6
  • 16