Search code examples
flutterdartlinter

How to disable the warning "Omit type annotations for local variables"? in Dart (with Pedantic Package)


I use the pedantic package in Flutter and I have the following anaylsis_options.yaml file:

include: package:pedantic/analysis_options.yaml # advanced linter

analyzer:
  enable-experiment:
    - extension-methods

linter:
  rules:
    omit_local_variables_types: false
    # always_specify_types: true

I try to disable the "Omit type annotations for local variables" warning. I can only disable it, I uncomment the last line (see question Dart 2.8.0 sdk: how to globally ignore omit_local_variable_types warning?). But I don't want to specify every type. So that's not what I want.

So how get I disable this warning globally?


Solution

  • I'm not sure if this is a feature that came later than when the question is posted, but according to here you can ignore rules.

    So if you want to disable warnings for omit_local_variable_types rule you can do the following in your anaylsis_options.yaml file:

    analyzer:
      errors:
        omit_local_variable_types: ignore