unnecessary_ new
Details about the 'unnecessary_new' diagnostic produced by the Dart analyzer.
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:
var o = new Object();
Common fixes
#Remove the keyword new:
var o = Object();
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Report an issue.