[Flutter tip] How to ignore lowerCamelCase warnings for your whole project


If you like me, are coding generally in C# or other Camel case based programming language and start to  code in Flutter / Dart, you will always see a warning like this:

 

The variable name 'xxxx' isn't a lowerCamelCase identifier.
Try changing the name to follow the lowerCamelCase style.

To solve that, you can add a specific comment at the begining of each file where you have this issue. But maybe the most interesting thing for you is to do it only once in your whole project.

For that, you have to edit the following file: analysis_options.yaml
Add the following statements: non_constant_identifier_names: ignore


# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
include: package:flutter_lints/flutter.yaml

linter:
  rules:
    # avoid_print: false  # Uncomment to disable the `avoid_print` rule
    # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule
    # Disable the non_constant_identifier_names rule
    non_constant_identifier_names: false

analyzer:
  errors:
    # Treat these warnings as errors
    non_constant_identifier_names: ignore


No more warning!

Comments

Popular posts from this blog

EMGU with Xamarin Forms guide [part 1]

Xamarin Forms essential: FFImageLoading, manage your images

[SocialCut] released! Make instagram grids, panorama and more