For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/static_analysis/static_analysis_rules/dart-code-quality/non-constant-identifier-names.md. A documentation index is available at /llms.txt.

Use lowerCamelCase for non-constant identifiers

This product is not supported for your selected Datadog site. ().

Metadata

ID: dart-code-quality/non-constant-identifier-names

Language: Dart

Severity: Notice

Category: Code Style

Description

Non-constant identifiers (variables, functions, parameters, getters, and setters) must use lowerCamelCase in Dart. Using underscores or mixed conventions reduces readability and breaks tooling expectations. Rename the identifier so the first word is lowercase and each subsequent word starts with a capital letter.

Non-Compliant Code Examples

void my_function(int My_Param) {
  var My_Variable = 42;
  final AnotherVar = 'hello';
}

class MyClass {
  int my_field = 0;

  String get MyGetter => '';
}

Compliant Code Examples

const double pi = 3.14159;
const String APP_NAME = 'MyApp';
const int MY_CONSTANT = 42;

void myFunction(int myParam, String _unused) {
  var myVariable = 42;
  final anotherVar = 'hello';
  String _privateVar = '';
}

class MyClass {
  int myField = 0;

  String get myGetter => '';
  set mySetter(String v) {}
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Security