How can I disable all lints in a file?

Issue

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?

Solution

As of Dart 2.15, an inline ignore directive can be used to disable all lints in a file.

// ignore_for_file: type=lint

Case sensitivity and whitespace is ignored; the following styles also work, for example:

  • TYPE=LINT
  • type = lint

To learn more, the discussion leading up to this addition to the analyser can be found in the related GitHub issue and code review thread.

Answered By – hacker1024

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.