In Android Studio, how do I change the Flutter naming conventions?

Issue

Apparently Google and/or JetBrains think everyone ought to use CamelCase, but (a) I prefer snake_case (use of underscores), (b) nearly every line of my sources now has a lint complaint, making it hard to separate the wheat from the chaff, and (c) I don’t have time to rewrite all my code just to pander to other people’s aesthetic sense.
How do I convince AS to be a Philistine like me?

Android Studio has a Kotlin naming convention in inspection settings

but It seems Android Studio does not have a flutter naming convetion in inspetion settings

Solution

I referenced some documents @pskink saying, https://dart.dev/guides/language/analysis-options#enabling-linter-rules

since I wanted to use underscore when creating a variable, what I did is

Firstly, making a analysis_options.yaml file in top level directories like pubspec.yaml

Secondly, then implement like this in analysis_options.yaml

include: package:pedantic/analysis_options.yaml

linter: 
  rules:
non_constant_identifier_names: false

and Lastly in pubspec.yaml file,

dev_dependencies:
  pedantic: ^1.0.0

then no more showing "Name non-constant identifiers using lowerCamelCase."

Answered By – roun paleum

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published