dartdart-analyzer

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?


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:

    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.