APEALED
APEALED

Reputation: 1663

How to remove todo static analysis for Dart/Flutter projects?

Dart and flutter have a static analysis linter/tool. Most of the time I find it useful, except for TODO comments in my code. I have a different way of tracking my todos in code (beyond the static analysis tool).

How can I disable this analysis for all my todo comments? I don't want to have to add an ignore statement (ignore: todo) for each item either, like below.

Example:

// I don't want to have to do this every time.

// ignore: todo
// TODO: implement rest of class
class SomeClass {
    Object someValue;
}

Upvotes: 11

Views: 3854

Answers (2)

Cerce
Cerce

Reputation: 298

Moving @APEALED comment to be a top level answer, as it is the one that most helped me.

If you use VS Code and the Dart-Code extension, you can add the following to you settings.json to disable only todos in your editor: "dart.showTodos": false.

Upvotes: 2

APEALED
APEALED

Reputation: 1663

The solution is on the Linter for Dart: Ignoring rules (page).

You'll need to add an analysis_options.yaml file option at the root of your directory and add the following rules:

analysis_options.yaml
analyzer:
  errors:
    todo: ignore

Credit goes to pskink for making me look twice at the page (from the comment section).

dart.dev/guides/language/analysis-optionspskink

Upvotes: 22

Related Questions