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/camel-case-types.md. A documentation index is available at /llms.txt.
This product is not supported for your selected Datadog site. ().

Metadata

ID: dart-code-quality/camel-case-types

Language: Dart

Severity: Notice

Category: Code Style

Description

In Dart, all type names (classes, enums, typedefs, and type parameters) must use UpperCamelCase (e.g. MyClass, not my_class or myClass). This convention makes types instantly recognizable and aligns with the Dart style guide. Rename the type so each word starts with a capital letter with no separators.

Non-Compliant Code Examples

class my_class {}
class myClass {}
enum my_enum { a, b }
typedef my_typedef = void Function();
mixin my_mixin {}

Compliant Code Examples

class MyClass {}
class _PrivateClass {}
enum MyEnum { a, b }
typedef MyTypedef = void Function();
typedef bool InsertWallFunction(double x, int y);
mixin MyMixin {}
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