Non-constant identifiers should be in https://en.wikipedia.org/wiki/Camel_case[lowerCamelCase].

== Why is this an issue?

A naming convention in software development is a set of guidelines for naming code elements like variables, functions, and classes.

The goal of a naming convention is to make the code more readable and understandable, which makes it easier to maintain and debug. It also ensures consistency in the code, especially when multiple developers are working on the same project.

Dart recommends using lowerCamelCase for all non-constant identifiers:

* members of classes and mixins, such as constructors, methods, fields and properties
* top-level functions and variables
* parameters of functions and methods

This means that the first letter of the identifier is lowercase, and the first letter of each subsequent word is capitalized, using no separators such as `_`.

The rule doesn't check `enum` values. Those are implicitly defined as constants, but treated separately

=== What is the potential impact?

Using the wrong casing can lead to confusion and wrong assumptions about the code. For example naming a top-level function in Pascal Case may mislead the reader to think it's a type, like a class or a mixin.

== How to fix it

Rename the identifier to use camel case.

=== Code examples

==== Noncompliant code example

[source,dart,diff-id=1,diff-type=noncompliant]
----
var ATopLevelVariable = 42;   // Noncompliant
void ATopLevelFunction() {}   // Noncompliant
class AClass {
    void AMemberFunction() {} // Noncompliant
}
----

==== Compliant solution

[source,dart,diff-id=1,diff-type=compliant]
----
var aTopLevelVariable = 42;
void aTopLevelFunction() {}
class AClass {
    void aMemberFunction() {}
}
----

== Resources

=== Documentation

* Dart Docs - https://dart.dev/tools/linter-rules/non_constant_identifier_names[Linter rules - non_constant_identifier_names]
* Wikipedia - https://en.wikipedia.org/wiki/Camel_case[Camel case]

=== Related rules

* S101 - Class names should comply with a naming convention
* S7046 - Extension identifiers should comply with a naming convention


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

* The variable name '<identifierName>' isn't a lowerCamelCase identifier.

=== Highlighting

The identifier name. If a generic method, the name doesn't include the type parameters.

'''
== Comments And Links
(visible only on this page)

endif::env-github,rspecator-view[]
