---
title: Don't use the new keyword
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Don't use the new keyword
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Don't use the new keyword

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `dart-code-quality/unnecessary-new`

**Language:** Dart

**Severity:** Notice

**Category:** Code Style

## Description{% #description %}

Since Dart 2, the `new` keyword is optional when calling a constructor. It does not change behavior and only adds noise to the code.

Prefer constructor calls without `new`, such as `List()` instead of `new List()`.

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```dart
class Foo {
  Foo();
  Foo.named();
}

void main() {
  var list = new List<int>();
  var foo = new Foo();
  var named = new Foo.named();
}
```

## Compliant Code Examples{% #compliant-code-examples %}

```dart
class Foo {
  Foo();
  Foo.named();
}

void main() {
  var list = List<int>();
  var map = Map<String, int>();
  var foo = Foo();
  var named = Foo.named();
  const value = Foo();
}
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 