Skip to main content

unnecessary_new

Unnecessary 'new' keyword.

Description

#

The analyzer produces this diagnostic when the keyword new is used to invoke a constructor.

Example

#

The following code produces this diagnostic because the keyword new is used to invoke the unnamed constructor from Object:

dart
var o = new Object();

Common fixes

#

Remove the keyword new:

dart
var o = Object();